Skip to content

Instantly share code, notes, and snippets.

@TravisMullen
Created February 17, 2016 04:53
Show Gist options
  • Save TravisMullen/f7272e7a19ae34bdef34 to your computer and use it in GitHub Desktop.
Save TravisMullen/f7272e7a19ae34bdef34 to your computer and use it in GitHub Desktop.
jQuery-less Wait for DOM Complete
var waitForDocument = setInterval(function() {
if (document.readyState !== 'complete') return;
// or var WIN = window.open();
// if (WIN.document.readyState !== 'complete') return;
// if (WIN.opener.document.readyState !== 'complete') return;
clearInterval(waitForDocument);
// do your work
}, 100);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment