Created
December 5, 2017 21:48
-
-
Save rdillmanCN/8515ac878e4221241a22cc1161aa1e13 to your computer and use it in GitHub Desktop.
Find all globals not native to the window object.
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 f() { | |
var frm = document.createElement("iframe"); | |
frm.style.display = "none"; | |
document.body.appendChild(frm); | |
var a = Object.getOwnPropertyNames(frm.contentWindow); | |
var b = Object.getOwnPropertyNames(window); | |
var tab = {}; | |
b.filter(function(c) { | |
return a.indexOf(c) === -1; | |
}).map(function(i) { | |
if (typeof window[i] !== 'undefined') { | |
tab[i] = Array.isArray(window[i]) ? 'array' : typeof window[i]; | |
} | |
}); | |
document.body.removeChild(frm); | |
console.group("Globals Data"); | |
console.table(tab); | |
console.groupEnd("Globals Data"); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment