Skip to content

Instantly share code, notes, and snippets.

@bradoyler
Created November 29, 2013 06:26
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 bradoyler/7702215 to your computer and use it in GitHub Desktop.
Save bradoyler/7702215 to your computer and use it in GitHub Desktop.
/* log-globals by Sindre Sorhus https://github.com/sindresorhus/log-globals MIT License */
(function () { 'use strict';
function getIframe() {
var el = document.createElement('iframe');
el.style.display = 'none';
document.body.appendChild(el);
var win = el.contentWindow;
document.body.removeChild(el);
return win;
}
function detectGlobals() {
var iframe = getIframe();
var ret = Object.create(null);
for (var prop in window) {
if (!(prop in iframe)) {
ret[prop] = window[prop];
}
} return ret;
}
console.log(detectGlobals());
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment