Forum Moderators: open

Message Too Old, No Replies

iframe's DOM

Need help on manipulating the DOM of a document within an iframe

         

paul411

5:39 pm on Mar 31, 2007 (gmt 0)

10+ Year Member



Hi,

What i basically want to do is to manipulate or access the DOM of a document within an iframe.

So far, I've tried this on orkut's homepage (to access the iframe containing the Google Accounts Login)

As entered in FireFox's address bar:


javascript:alert(window.frames[0].document.getElementById('t').innerHTML); void(0);

If I try this, I get the following error (in the Error Console):


Error: uncaught exception: Permission denied to get property HTMLDocument.getElementById

How can I access and modify the DOM of an iframe?

Dabrowski

8:34 pm on Mar 31, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The IFRAME src has to be of the same domain as the parent for JS to work across frames. Same with framesets.