Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
iFrames: tricks, reference, etc
// create the iFrame
var iFrame = document.createElement('iframe');
// set iFrame's source
iFrame.src = "javascript:false"; // add some URL here
// inject iFrame into current (parent) doc before first script tag
var where = document.getElementsByTagName('script')[0];
where.parentNode.insertBefore(iFrame, where);
// get iFrame's window and document objects
var iFrameWindow = iFrame.contentWindow || iFrame;
var iFrameWindow = iFrame.contentDocument || iFrame.contentWindow.document;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.