Created
July 13, 2009 18:11
-
-
Save bjensen/146346 to your computer and use it in GitHub Desktop.
Get the iframe document object
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/ How to get the iframe document object | |
// Assume 'iframe' is a variable to the iframe DOM element | |
var iframe_document = null; | |
if (iframe.contentDocument) iframe_document = iframe.contentDocument; | |
else if (iframe.contentWindow) iframe_document = iframe.contentWindow.document; | |
else if (iframe.document) iframe_document = iframe.document; | |
else throw(new Error("Cannot access iframe document.")); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment