Skip to content

Instantly share code, notes, and snippets.

@alexrqs
Created August 28, 2018 20:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save alexrqs/fff9690caa5fc0bdc6890d58bc6eb372 to your computer and use it in GitHub Desktop.
Save alexrqs/fff9690caa5fc0bdc6890d58bc6eb372 to your computer and use it in GitHub Desktop.
Get window properties defined by the user
(function () {
var results, currentWindow,
// create an iframe and append to body to load a clean window object
iframe = document.createElement('iframe');
iframe.style.display = 'none';
document.body.appendChild(iframe);
// get the current list of properties on window
currentWindow = Object.getOwnPropertyNames(window);
// filter the list against the properties that exist in the clean window
results = currentWindow.filter(function(prop) {
return !iframe.contentWindow.hasOwnProperty(prop);
});
document.body.removeChild(iframe);
// log an array of properties that are different
console.log(results);
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment