简体   繁体   English

Chrome扩展程序弹出窗口无法打开

[英]Chrome extension popup not opening

I understand that popups are made up of a html file. 我了解弹出式窗口是由html文件组成的。 Below is my code. 下面是我的代码。 For some reason the popup window won't open when I click the icon. 由于某些原因,当我单击图标时,弹出窗口将无法打开。 Any ideas on what the problem may be? 关于可能是什么问题的任何想法?

{
    "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
}

Try changing page_action to browser_action So like this: 尝试将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

} }

I've had this problem as well. 我也有这个问题。 But instead of changing it to browser_action , i instead kept the page_action . 但是,我没有将其更改为browser_action ,而是保留了page_action see declarativeContent 参见declarativeContent

The thing I've heard is, browser_action should only be used if your extension use features that make sense on most pages. 我所听到的是,仅当您的扩展程序使用对大多数页面有意义的功能时,才应使用browser_action。 Else use page action. 否则使用页面操作。

Source: What are the differences between page action and browser action? 来源: 页面操作和浏览器操作之间有什么区别?

So with page_action, you specify what website your extension would work on with said declarativeContent. 因此,使用page_action时,您可以使用declarativeContent指定您的扩展程序可以在哪个网站上运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM