Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get all javascript variables in document

Is there a way to retrieve all Javascript variables within a page?

For example, Firebug can view all of the JS vars, so I know it's possible, but I'm unsure on how to do it.

like image 533
Tim Ferrell Avatar asked Jul 08 '26 03:07

Tim Ferrell


1 Answers

To get global variables:

var x=[];
for (var i in window){
    x.push(i)
};
alert(x.join("\\"));

They are stored in window object

you can see more info here:

http://seanmonstar.com/post/708979238/iterating-global-variables-in-internet-explorer

like image 121
Roman Goyenko Avatar answered Jul 10 '26 18:07

Roman Goyenko



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!