Get Globals

by Simon Herteby

HTML

<pre>
function getGlobals(){
  const result = {...window}  
  const standard = window.open()
  Object.keys(standard).forEach(key => delete result[key])
  standard.close()
  return result
}
getGlobals()
</pre>
<hr>
<p>
  <b>Fun inspection tool</b>. Run this function in the console to see what global variables an app has added.
</p>
<p>
  It works by opening a new window, to use as a fresh reference, and then comparing the global variables of your current window to the new one to see what's been added.
</p>