Created
August 10, 2016 10:24
-
-
Save keeganstreet/8f9394f7c12e187fb2be4c6b6335d7f5 to your computer and use it in GitHub Desktop.
Show all global variables, excluding native browser ones
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
(function() { | |
var windowKeys = Object.keys(window), | |
iframe = document.createElement('iframe'), | |
cleanWindowKeys, | |
customVars; | |
document.body.appendChild(iframe); | |
cleanWindowKeys = Object.keys(iframe.contentWindow); | |
customVars = windowKeys.filter(function(key) { | |
return (cleanWindowKeys.indexOf(key) === -1); | |
}); | |
return customVars; | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment