Reputation: 2345
I am experiencing a javascript bug in internet explorer and I suspect its due to a name of a div matching with a global object.
My application loads many javascript libraries.
I want to find what global objects are loaded at runtime
Upvotes: 4
Views: 4873
Reputation: 31801
You can simply inspect the window
object in Chrome/Firefox devtools: just type window
in the devtools console and expand the object to view its members.
Upvotes: 0
Reputation: 707916
Since all user JS defined global objects/vars are properties of the window object, you can list all the enumerable ones with this:
for (var item in window) {
console.log(item);
}
This will get you a list of a lot of things including all global functions. If you want to filter out global functions, you can use this:
for (var item in window) {
var type = typeof window[item];
if (type != "function") {
console.log(item + " (" + type + ")");
}
}
Upvotes: 5