Last active
August 28, 2018 09:14
-
-
Save wanderer06/b01772fa0a1deed83eb7750901207474 to your computer and use it in GitHub Desktop.
List all non-standard properties on the window.
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 () { | |
var results, currentWindow, typedResult | |
iframe = document.createElement('iframe'); | |
iframe.style.display = 'none'; | |
document.body.appendChild(iframe); | |
currentWindow = Object.keys(window); | |
results = currentWindow.filter(function(prop) { | |
return !iframe.contentWindow.hasOwnProperty(prop); | |
}); | |
typedResult = {}; | |
results.forEach(key => { | |
const keyType = typeof window[key]; | |
(typedResult[keyType] || (typedResult[keyType] = {}, typedResult[keyType]))[key] = window[key]; | |
}); | |
console.log(typedResult); | |
document.body.removeChild(iframe); | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment