Created
December 30, 2017 09:21
-
-
Save rdillmanCN/a7c4d8528d5481108f88ae81242fffb0 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