How do I dump JavaScript vars in IE8?

后端 未结 11 647
既然无缘
既然无缘 2020-12-02 08:04

I have an object I need to examine in IE8. I tried the developer tools and console.log, their Firebug equivalent. However, when I output the object to the log:<

相关标签:
11条回答
  • 2020-12-02 08:59

    console.log(element.toString()) might be your friend here...

    0 讨论(0)
  • 2020-12-02 09:00

    Add this Tag in your page :

    <script type="text/javascript" src="https://getfirebug.com/firebug-lite-debug.js"></script>

    And the things will work.

    Its working on my system.

    Note: Do try this solution.

    0 讨论(0)
  • 2020-12-02 09:00

    A bit chunky but it works for DOM objects:

     console.log( testNode.outerHTML.replace(testNode.innerHTML,"") ); 
    
    0 讨论(0)
  • 2020-12-02 09:03

    @Chris commented @Andy's answer with the simple solution: Use console.dir(myObj) to get all the details printed out in the console in IE. Thanks Chris!

    0 讨论(0)
  • 2020-12-02 09:03

    Dump it into an existing HMTL-Element

    I noticed IE 11 is stripping off console lines after 1027 chars :-/ When I had a large object to dump (12,000 chars) I dumped it into an existing DIV- oder TextArea-Element, from where I could copy the content.

    var str = JSON.stringify(myObject);
    $('#existing-element').text(str); // jQuery or
    document.querySelector("#existing-element").innerHTML = str; // native JavaScript
    
    0 讨论(0)
提交回复
热议问题