Javascript view all page variable in console

If you want to see all the javascript variables set in the page via the console you can use the following function.

<pre class="brush: javascript; gutter: false">function showNonNatives ()

{

var _arrHits = []

for(var b in window)

{

if(window.hasOwnProperty(b))

{

//console.log(b);

try{_arrHits.push(b + &quot; = &quot; + window[b]);}catch(e){};

}

}

return _arrHits;

}</pre>

Here is a screenshot of how to run the function in the console

If you have any suggestions on how to improve this please contact us.

Recent Posts
Categories
Search By Tags
Archive

Certified Development

We design, build, develop, manage, advise and host Laravel and Magento

Ecomus logo

London, Brighton and the UK

©2008 - 2020 Ecomus Ltd.  All Rights Reserved