Displaying Javascript Environment, functions and Variables

A

Aaron Gray

I want to display all the variables and functions availiable to a web page.
I used to have a JavaScript that did this but are unable to get it at the
moment, could someone post such a script please.

Aaron
 
M

Martin Honnen

Aaron said:
I want to display all the variables and functions availiable to a web page.
I used to have a JavaScript that did this but are unable to get it at the
moment, could someone post such a script please.

You can enumerate the properties and methods of an object, for instance
the window object
var text = '';
for (var property in window) {
text += property + ': ' + (typeof window[property] + '; ';
}
alert(text);
But it depends on the browser whether host methods like resizeTo are
exposed to the for .. in enuemration.
 
A

Aaron Gray

You can enumerate the properties and methods of an object, for instance
the window object
var text = '';
for (var property in window) {
text += property + ': ' + (typeof window[property] + '; ';
}
alert(text);
But it depends on the browser whether host methods like resizeTo are
exposed to the for .. in enuemration.

Thanks, that's a good start,

Aaron
 
T

Thomas 'PointedEars' Lahn

Aaron said:
I want to display all the variables and functions availiable to a web
page. I used to have a JavaScript that did this but are unable to get
it at the moment, could someone post such a script please.

Try <http://pointedears.de/ObjectInspector> (or
<http://pointedears.ml-webhosting.de/ObjectInspector>).

But note that since I am using my own script libraries to realize the
app, many items that are displayed are not built-in but defined in the
libraries; I have not found a way to workaround that effectively yet,
suggestions are welcome. Sometimes you can distinguish between built-in
and library properties anyway since the former are often not enumerable
and so have the icon for the DontEnum flag displayed, and their value
contains specific substrings like "[native code]".


HTH

PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,781
Messages
2,569,615
Members
45,294
Latest member
LandonPigo

Latest Threads

Top