Skip to content

Instantly share code, notes, and snippets.

@gf3
Created Jul 13, 2009
Embed
What would you like to do?
Get the iframe document object
// 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."));
@mathiasbynens

This comment has been minimized.

Copy link

@mathiasbynens mathiasbynens commented Jun 3, 2010

If you’re using jQuery: $('iframe').contents(); (Hat tip: Ben Alman)

@miketaylr

This comment has been minimized.

Copy link

@miketaylr miketaylr commented Jun 7, 2010

If you're using a TI-83 Scientific Calculator you can press 2nd VARS. I think.

@akahn

This comment has been minimized.

Copy link

@akahn akahn commented Jun 16, 2010

TI-83 is a graphing calculator, doophus.

P.S. I have a really great Dope Wars for it if you want. Let me know if you need to borrow my cable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment