google chrome extension :: console.log() from background page?

后端 未结 11 1993

If I call console.log(\'something\'); from the popup page, or any script included off that it works fine.

However as the background page is not directly

11条回答
  •  无人及你
    2020-11-30 17:39

    The simplest solution would be to add the following code on the top of the file. And than you can use all full Chrome console api as you would normally.

     console = chrome.extension.getBackgroundPage().console;
    // for instance, console.assert(1!=1) will return assertion error
    // console.log("msg") ==> prints msg
    // etc
    

提交回复
热议问题