Skip to content

Instantly share code, notes, and snippets.

@keeganstreet
Created August 10, 2016 10:24
Show Gist options
  • Save keeganstreet/8f9394f7c12e187fb2be4c6b6335d7f5 to your computer and use it in GitHub Desktop.
Save keeganstreet/8f9394f7c12e187fb2be4c6b6335d7f5 to your computer and use it in GitHub Desktop.
Show all global variables, excluding native browser ones
(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