【发布时间】:2016-03-19 21:37:54
【问题描述】:
我正在遵循创建 chrome 扩展的基础知识 https://developer.chrome.com/extensions/getstarted 我放置了一个 console.log() 语句,但它不会显示,我应该使用其他一些 API 在控制台上记录内容吗?
【问题讨论】:
我正在遵循创建 chrome 扩展的基础知识 https://developer.chrome.com/extensions/getstarted 我放置了一个 console.log() 语句,但它不会显示,我应该使用其他一些 API 在控制台上记录内容吗?
【问题讨论】:
不,你应该找对地方。
background 或 event page 的控制台和开发工具可通过开发人员模式下的扩展列表访问 - 那里有 will be a link under the extension listing。
额外说明:事件页面的卸载会丢失它的日志。
popup page 的控制台和开发工具是 accessible through right-clicking the action's button 并选择“检查弹出窗口”。
content script 的控制台和开发工具可通过内容脚本在其中执行的页面的常规开发工具进行访问。
额外说明:由于是内容脚本executes in a different context,如果您想在其中运行命令,则需要select that context above the console,而不是页面本身。
【讨论】: