baptx baptx - 1 year ago 79
HTML Question

Access external HTML page content of object tags

I've searched an answer to this question but can't get a way how to do it.

I want to access the content of a div that I have included in an object tag.

My include.htm file:

<div id="includedDiv">This is the included page</div>

What I have tried :

<title>Get element from object included page</title>
<p>Test: This is the main page</p>
<object id="obj" data="include.htm"></object>

None of the alert prints me the message "This is the included page", is there a way to get this content from the DOM?

window[0].document.getElementById("includedDiv").firstChild.nodeValue; was the the good answer for access through the DOM, object tag just creates another window :)

Answer Source

Even better answer: you CAN access object tag content through the DOM, it is just another window!


That's it :D

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download