Skip to content

Instantly share code, notes, and snippets.

@rcherny
Created March 23, 2019 13:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rcherny/486184a02a8d5cd9798705a247b225d9 to your computer and use it in GitHub Desktop.
Save rcherny/486184a02a8d5cd9798705a247b225d9 to your computer and use it in GitHub Desktop.
Find the globals defined by the current page on window
// find the globals defined by the current page
(function(){
var iframe = document.createElement('iframe');
iframe.src = "about:blank";
document.body.appendChild(iframe);
var windowVars = Object.keys(iframe.contentWindow);
var globalVars = Object.keys(window).filter(key => !windowVars.includes(key));
console.log("global Vars:", globalVars);
document.body.removeChild(iframe);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment