It appears you have not registered with our community. To register please click here ...

Author Topic: How To View Javascript Variables of a Web Page  (Read 1950 times)

ctwjr

  • Super Moderator
  • Jr. Member
  • **
  • Posts: 72
  • Karma: +10/-0
    • View Profile
    • http://www.ftplive.com
    • Email
How To View Javascript Variables of a Web Page
« on: April 01, 2007, 07:31:17 PM »
Here is a neat trick, go to any web page and enter the following javascript in the address bar:

javascript:(function(){var x,d,i,v,st; x=open(); d=x.document; d.open(); function hE(s){s=s.replace(/&/g,%22&%22);s=s.replace(/>/g,%22>%22);s=s.replace(/td{vertical-align:top; white-space:pre; } table,td,th { border: 1px solid #ccc; } div.er { color:red }%22); for (i in window) { if (!(i in x) ) { v=window[i]; d.write(%22%22); } } d.write(%22
VariableTypeValue as string
%22 + hE(i) + %22%22 + hE(typeof(window[i])) + %22%22); if (v===null) d.write(%22null%22); else if (v===undefined) d.write(%22undefined%22); else try{st=v.toString(); if (st.length)d.write(hE(v.toString())); else d.write(%22%C2%A0%22)}catch(er){d.write(%22
%22+hE(er.toString())+%22
%22)}; d.write(%22
%22); d.close(); })();

It will open a new window and display all the javascript variables loaded for that particular page.  NEAT!

 

Related Topics

  Subject / Started by Replies Last post
3 Replies
2885 Views
Last post August 05, 2005, 06:57:54 PM
by zelo
13 Replies
3374 Views
Last post November 14, 2005, 07:03:32 PM
by adb22791
0 Replies
1511 Views
Last post October 02, 2006, 08:32:01 AM
by dynaweb
0 Replies
2445 Views
Last post April 05, 2007, 09:11:09 PM
by zelo