Chrome devtools extension console

后端 未结 2 938
滥情空心
滥情空心 2021-02-14 10:22

I included this in my chrome extension manifest

\"devtools_page\": \"devtools.html\"

And in devtools.html I include a devtools.js file which c

相关标签:
2条回答
  • 2021-02-14 10:44

    Another way to do it is to open the chrome devtools in a separate window (not on the side of the browser) and then press CMD + Shift + i (for Mac) and then you get another devtools for that devtools. There you can debug and see console logs easier :)

    0 讨论(0)
  • 2021-02-14 10:53

    This message will be logged in the console of the developer tools. To view this console, detach the developer tools from the window, and press Ctrl + Shift + J.

    Here's an picture:

    1. Page (http://host/)
    2. + Devtools instance for http://host
    3.   + Devtools instance for chrome-devtools://devtools/devtools.html?... )
    

    Your message is currently logged to 3 (the console of the devtools instance) instead of 2 (the console of the page). To log the string to the page, use the chrome.experimental.devtools.console API.

    An alternative is to JSON-serialize your object, and use chrome.devtools.inspectedWindow.eval to log the result:

    var obj = ...;
    var str = JSON.stringify( obj );
    chrome.devtools.inspectedWindow.eval('console.log(' + str + ');');
    
    0 讨论(0)
提交回复
热议问题