Created
May 27, 2016 03:04
-
-
Save darcyclarke/cd146fd510c34adf26f96794a6dec93f to your computer and use it in GitHub Desktop.
Get Clean window & DOM Objects
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*! | |
* | |
* Get Clean window & DOM Objects | |
* http://darcyclarke.me/articles/development/getting-a-clean-document-or-window-object-in-javascript/ | |
* | |
* Copyright 2016, Darcy Clarke | |
* Do what you want license | |
* | |
*/ | |
(function(){ | |
var iframe = document.createElement('iframe'); | |
iframe.style.display = 'none'; | |
iframe = document.body.appendChild(iframe); | |
var _window = iframe.contentWindow, _document = iframe.contentDocument || iframe.contentWindow.document ; | |
document.body.removeChild(iframe); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment