Skip to content

Instantly share code, notes, and snippets.

@jbgo
Last active December 19, 2015 04:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jbgo/5901518 to your computer and use it in GitHub Desktop.
Save jbgo/5901518 to your computer and use it in GitHub Desktop.
Cross-browser iframe access (tested with IE 7+)

For those unfortunate times when you need to use duct tape to support a slick user experience on really old browsers.

frame = $('iframe').get(0)

doc = if frame.contentWindow
  frame.contentWindow.document
else
  frame.contentDocument

$('some.selector', doc)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment