Displaying objects in IE Developer Tools console

2019-02-02 21:59发布

I'm debugging my web application in Firefox, Chrome and Internet Explorer. With the latter I'm using Developer Tools to debug my scripts.

The problem I'm having is that when I write some expression in console window and it should return an object all I can see is a simple {...} which isn't really helpful.

Is it possible to make it work similar to Firebug or Chrome console that actually display object content. Chrome is the best in this regard, because you can directly traverse the whole object as in Visual Studio.

Anyway. Is it possible to make IE Developer Tools console to display object properties and their values?

8条回答
在下西门庆
2楼-- · 2019-02-02 22:19

Add the object to watch and you can see and analyze it completely from watch panel.

查看更多
对你真心纯属浪费
3楼-- · 2019-02-02 22:22

I use the built in JSON object.

JSON.stringify(my_object)
查看更多
Bombasti
4楼-- · 2019-02-02 22:22

Here's a rather off-the-wall way to do it... run the object through JSON.stringify and display the results of that instead.

查看更多
We Are One
5楼-- · 2019-02-02 22:23

What works for me and this may just be something they added recently but after you pull up the console log. Clear the log but leave the console open then refresh the page. As the page loads in, you should then be able to explore the objects. I am not sure why it needs to be done that way but it appears to work.

查看更多
Root(大扎)
6楼-- · 2019-02-02 22:24

Try this in the console script window:

for (var a in object) {
    console.log("object["+a+"]="+object[a])
}

For example,

for (var a in document.head){
    console.log("document.head["+a+"]="+document.head[a])
}
查看更多
叛逆
7楼-- · 2019-02-02 22:28

If the Prototype API is an option, you can debug your objects like so:

var obj = window.JSON.parse('{"d":"2010-01-01T12:34:56Z","i":123}');
alert($H(obj).inspect());

Other than that, I know of no other way to not get the really helpful {...}.

查看更多
登录 后发表回答