Created
December 30, 2017 09:31
-
-
Save RichardDillman/8d68e75fc59757b8c4fe7366f418150b to your computer and use it in GitHub Desktop.
Find all globals not native to the window object.
This file contains hidden or 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