Reputation:
How to refer to a component inside an IFRAME
is showed in this reply. It works under the assumption that there's only one IFRAME
(or that we are certain that the zero-th will suffice). However, I wonder how to identify the actual IFRAME
I'd like to poke.
I need the syntax for changing:
window.frames[0].document. + my stuff
into something like:
window.frames["theIdOfMyIFrame"].document. + my stuff
but I can't get it right.
Upvotes: 0
Views: 279
Reputation: 39118
You can refer to the embedded components like this.
document.getElementById("theIdOfMyIFrame")
.contentDocument.getElementById("controlIdInTheembeddedPage")
.value = "Christophe has eyes for details!";
Upvotes: 0
Reputation: 121
I dealt with this problem earlier.
If you show the response of a cross-site request in an iframe, the new browsers are denying the access to this iframe, because of the same-origin policy or cross-site scripting/request prohibition.
For more information see here: IFrame Permission Denied
If you want to dynamically add content, this solution might help you: Add Dynamic Content
Best regards
Upvotes: 1
Reputation:
Use document.getElementById
instead of the nasty deprecated window.frames
property:
document.getElementById("theIdOfMyIFrame").contentDocument ...
Upvotes: 0