To execute a script within in IFRAME from the parent page
Seems simple right? Sure it is... unless you want something that works in IE, Firefox, Chrome, and Safari. There are tons of blog posts, and articles on how to execute the script from the IFRAME on the parent, but surprisingly few articles on the opposite.
At the end of the day, this code should work in all 4 browsers:
function fnEvalFrame(iframe, command) {
if (!iframe.eval && iframe.execScript) {
iframe.execScript("null");
}
iframe.eval(command);
}
Also, when referring to your frames, use self.frames (or self.frames[], window.frames[], top.frames[], parent.frames[]) and not document.frames
References:
Firefox and document.frames
SSRS And Firefox
JavaScript eval in iframes
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment