I have an iframe embedded on my webpage and I'd like to edit certain parts of it using javascript. Is this possible and how would I do it?
+1
A:
You can get the iframe document by doing this:
document.getElementById(iframeId).contentDocument
That is if you own the page loaded in the iframe.
Jeremy
2010-04-01 20:39:26
+3
A:
Since the iframe is loading content from another domain — no. You'll hit the same origin policy.
David Dorward
2010-04-01 20:41:20
+2
A:
According to the HTML DOM spec (level 2), you can reach the child DOM by using the .contentDocument
property of the iframe's DOM node.
But, of course, no browser lets you do that across domains anymore...
SamB
2010-04-01 20:42:25