Chrome 扩展弹出窗口未打开

Chrome extension popup not opening

我知道弹出窗口是由 html 文件组成的。下面是我的代码。出于某种原因,当我单击该图标时,弹出窗口 window 不会打开。关于问题可能是什么的任何想法?

{
    "name": "Popup Snake",
    "version": "1.0",
    "description": "A simple snake game popup, that can be opened by clicking the icon in the top right (after installing)",
    "page_action": {
      "default_popup": "popup.html"
    },
    "manifest_version": 2
}

尝试将 page_action 更改为 browser_action 所以像这样:

{
"name": "Popup Snake",
"version": "1.0",
"description": "A simple snake game popup, that can be opened by clicking the icon in the top right (after installing)",
"browser_action": {
  "default_popup": "popup.html"
},
"manifest_version": 2

}

我也遇到过这个问题。但是我没有将它更改为 browser_action,而是保留了 page_action。见 declarativeContent

我听说,browser_action 只应在您的扩展程序使用对大多数页面都有意义的功能时使用。否则使用页面操作。

来源:页面操作和浏览器操作有什么区别?

因此,使用 page_action,您可以指定您的扩展程序将在哪个网站上使用所述 declarativeContent。