【问题标题】:Chrome extension popup not openingChrome 扩展弹出窗口未打开
【发布时间】:2018-06-20 15:32:43
【问题描述】:

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

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

【问题讨论】:

    标签: javascript html json google-chrome-extension popup


    【解决方案1】:

    尝试将 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
    

    }

    【讨论】:

      【解决方案2】:

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

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

      来源:What are the differences between page action and browser action?

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

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2022-06-16
        • 1970-01-01
        • 2018-10-01
        • 2021-10-20
        • 2017-12-29
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多