0

I am new to web development.I have loaded an external webpage into my website and i want to manipulate the HTML of that page. I want to hide the button with the id "sharepopup" in the code below. But it is not working. What am I doing wrong

<div id="content" >
<object type="type/html" data=http://credihealth.com>           
</object>    
</div>

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js">
</script>
<script>
$(document).ready(function(){
$("#sharepopup").hide();
});
</script>
user2887254
  • 33
  • 1
  • 4

1 Answers1

1

You can't access the DOM of third party websites. That would be a security risk.

You can use postMessage to communicate between cooperating websites on different origins (although I don't know if it works when using <object> instead of <iframe>).

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335
  • The asker's iframe content is not from the "same-origin" as javascript being run to modify it, therefore, it cannot directly modify the iframe contents. Check out this question/answer for more information: http://stackoverflow.com/questions/364952/jquery-javascript-accessing-contents-of-an-iframe/364997#364997 – Andrew Theken Apr 07 '14 at 13:20
  • fair enough. Same basic premise, but you're right, sorry about that. :-) I edited my comment so that my incorrect info doesn't throw people off. – Andrew Theken Apr 07 '14 at 13:25