user2887254
user2887254

Reputation: 33

Changing HTML content of external webpage loaded into a DIV

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>

Upvotes: 0

Views: 294

Answers (1)

Quentin
Quentin

Reputation: 943564

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>).

Upvotes: 1

Related Questions