Access the DOM in iframe

First, let's try this "cross domain".

If you attempt to access the DOM in an iframe that contains a document from another domain, it fails. Web browsers are built to disallow this because it is a security risk.

But go ahead and try anyway. Clicking the button to the left of the inline frame will run a function that attempts to access the DOM of the document in that iframe. The document in this iframe comes from another site.


Now, we'll try it with the form in the iframe loaded from the same domain. Works just fine.


For further reading and explanation of a few caveats, try this article.

If you think about it, trying to access the DOM of a document in an iframe from another site or domain would be a serious security problem. It also occurs to me that the responsibility for assuring this does not happen is completely up to the browser. Whether or not a plugin, browser extension, or object loaded into a browser could possibly break these security restrictions, I'm not sure.

However, since everything (in terms of accessing the cross domain iframe DOM) is happening on the client, meaning it is downloaded and runs on the client's machine, you would think it would be possible somehow.


Scripts

Some places I can be found