如何使用console.log()调试Chrome扩展? [英] How to use console.log() to debug a Chrome extension?
问题描述
我试图使用
I'm trying to debug my Chrome extension using
console.log("message");
我的扩展工作正常(大部分),我点击调用函数执行的按钮一些东西。每一个函数都作为一个consloe.log()调试行。
My extension works fine (for the most part), I'm clicking buttons that call function which perform something. Every function as a consloe.log() debug line.
如果我在chrome加载后打开了chrome控制台(ctrl + shift + i),它仍然是空的,无论如何我做的事。 Chrome设置为开发者模式。
If I open the chrome console (ctrl + shift + i) after chrome loads, it remains empty, no matter what I do. Chrome is set to developer mode.
推荐答案
确保您打开了正确的开发控制台。您需要转到背景页面控制台的生成的背景页面
和右键单击 - >检查弹出控制台的弹出
。有一个很好的gif的类似问题的答案,我会链接它,如果我能找到它。
Make sure that you are opening the correct dev console. You need to go to the generated background page
for the background page console and right click -> inspect popup
for the popup console. There was an answer to a similar question with a nice gif, I will link it if I can find it.
这篇关于如何使用console.log()调试Chrome扩展?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!