Skip to content
Create a gist now

Instantly share code, notes, and snippets.

Embed URL


Subversion checkout URL

You can clone with
Download ZIP
BLOG: adoptNode()
try {
catch(exc) {
// performance hit. Either importNode, or load the frame contents with appendChild()
<div id="#placeholder"></div>
<!-- ...last node in the page... -->
<iframe id="theFrame" src="" style="left: -12345px; top: 0; position: absolute;"></iframe>
(function() {
var div = document.getElementById("placeholder");
var iframe = document.getElementById("theFrame");
window.setInterval(function putFrameOntoPlaceholder() {
// 1) measure the size of the iframe, change size of div
div.width = iframe.offsetWidth + "px";
div.height = iframe.offsetHeight + "px";
// 2) get the div's position on the page, position iframe
iframe.left = div.offsetLeft + "px"; = div.offsetHeight + "px";
}, 100);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.