Skip to content

Instantly share code, notes, and snippets.

@ngerritsen
Last active October 24, 2017 19:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ngerritsen/20473adb331e8673656ba862e294b2b0 to your computer and use it in GitHub Desktop.
Save ngerritsen/20473adb331e8673656ba862e294b2b0 to your computer and use it in GitHub Desktop.
Get all global variables in Chrome
(function () {
// Update this list with all libraries/global variables you DONT want to see. For instance if you DO want to see jQuery, remove it from this list.
const keysToFilter = ["$","jQuery","Modernizr","SS","ZeroClipboard","Hammer","CobrowserChatApi","_cobrowserapi","GoogleAnalyticsObject","ga","gaplugins","gaGlobal","scan","external","chrome","document","speechSynthesis","caches","ondeviceorientationabsolute","ondevicelight","localStorage","sessionStorage","webkitStorageInfo","indexedDB","webkitIndexedDB","ondeviceorientation","ondevicemotion","crypto","postMessage","blur","focus","close","onautocompleteerror","onautocomplete","onunhandledrejection","onrejectionhandled","applicationCache","performance","onunload","onstorage","onpopstate","onpageshow","onpagehide","ononline","onoffline","onmessage","onlanguagechange","onhashchange","onbeforeunload","onwaiting","onvolumechange","ontoggle","ontimeupdate","onsuspend","onsubmit","onstalled","onshow","onselect","onseeking","onseeked","onscroll","onresize","onreset","onratechange","onprogress","onplaying","onplay","onpause","onmousewheel","onmouseup","onmouseover","onmouseout","onmousemove","onmouseleave","onmouseenter","onmousedown","onloadstart","onloadedmetadata","onloadeddata","onload","onkeyup","onkeypress","onkeydown","oninvalid","oninput","onfocus","onerror","onended","onemptied","ondurationchange","ondrop","ondragstart","ondragover","ondragleave","ondragenter","ondragend","ondrag","ondblclick","oncuechange","oncontextmenu","onclose","onclick","onchange","oncanplaythrough","oncanplay","oncancel","onblur","onabort","isSecureContext","onwheel","onwebkittransitionend","onwebkitanimationstart","onwebkitanimationiteration","onwebkitanimationend","ontransitionend","onsearch","onanimationstart","onanimationiteration","onanimationend","styleMedia","defaultstatus","defaultStatus","screenTop","screenLeft","clientInformation","console","devicePixelRatio","outerHeight","outerWidth","screenY","screenX","pageYOffset","scrollY","pageXOffset","scrollX","innerHeight","innerWidth","screen","navigator","frameElement","parent","opener","top","length","frames","closed","status","toolbar","statusbar","scrollbars","personalbar","menubar","locationbar","history","location","name","self","window","stop","open","alert","confirm","prompt","print","requestAnimationFrame","cancelAnimationFrame","captureEvents","releaseEvents","getComputedStyle","matchMedia","moveTo","moveBy","resizeTo","resizeBy","getSelection","find","getMatchedCSSRules","webkitRequestAnimationFrame","webkitCancelAnimationFrame","webkitCancelRequestAnimationFrame","btoa","atob","setTimeout","clearTimeout","setInterval","clearInterval","requestIdleCallback","cancelIdleCallback","scroll","scrollTo","scrollBy","fetch","webkitRequestFileSystem","webkitResolveLocalFileSystemURL","openDatabase"];
return Object.keys(window)
.filter(function (key) {
return keysToFilter.filter(function (k) {
return k === key;
}).length === 0;
})
.reduce(function (obj, key) {
obj[key] = window[key];
return obj;
}, {});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment