Skip to content

Instantly share code, notes, and snippets.

@konijn
Last active December 11, 2015 17:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save konijn/4635185 to your computer and use it in GitHub Desktop.
Save konijn/4635185 to your computer and use it in GitHub Desktop.
Log in the console all globals, still will not tell you where you created the global..
/* Dump all 'user space' globals
Many thanks to glutamat: http://stackoverflow.com/questions/14585537 */
void( (function()
{
var w = document.body.appendChild( document.createElement("iframe") ).contentWindow,
known =
[
"screenLeft" , "screenTop" , "scrollX" , "scrollY" , "pageYOffset" , "pageXOffset" , /* Scrolling related built-ins */
"innerWidth" , "innerHeight" , "outerWidth" , "outerHeight" , /* Size related built-ins */
"defaultstatus" , "defaultStatus", /* Status bar text related built-ins */
"frameElement" , "length" , /* Frame related built-ins */
"opener" , "event" , "status" , "name" , "closed" , "external" , /* Generic Misc. */
"devicePixelRatio" , /* Webkit & Opera Misc.*/
"offscreenBuffering" , /* Webkit & IE Misc. */
"chrome" , "Intl" , "v8Intl" /* Webkit */
],
list = [], i = 1;
for(var key in window)
if( window.hasOwnProperty(key) && w[key] === undefined && !~known.indexOf(key) )
list.push(key);
list.sort().forEach( function(s){ console.log( i++ , s ) } );
})());
@konijn
Copy link
Author

konijn commented Jan 25, 2013

You can use this as a this as a bookmarklet, this is definitely beta quality, do not use for nuclear reactors ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment