Chrome扩展程序已损坏

时间:2017-12-21 21:19:37

标签: google-chrome google-chrome-extension corrupt

我的扩展程序有问题。当我从Chrome商店下载它时,它正在为我解压缩。

但是,有些用户报告更新扩展名已损坏。这是在他们将其更新为更新版本后发生的。

旧版和新版之间的区别是背景页和一些逻辑。

我能够通过打包扩展来复制该问题,而不是将其放入扩展选项卡。之后,我看到了与扩展用户相同的消息。我也尝试了另外的扩展,一切正常,所以也许清单文件中存在一些问题。

{
    "manifest_version": 2,

    "name": "Cryptocurrency Price Tracker",
    "description": "This simple extension allows you to track price changes of Bitcoin and other cryptocurrencies.",
    "version": "2.5",

    "icons": {
               "16":"icon16.png",
               "48":"icon48.png",
               "128":"icon128.png"
     },

    "browser_action": {
        "default_icon": "icon.png",
        "default_popup": "popup.html"
    },

    "options_ui": {
        "page": "options.html",
        "chrome_style": true
    },

    "background": {
        "scripts": ["background.js"]
    },

    "permissions": [
        "storage",
        "notifications",
        "https://api.coinmarketcap.com/v1/*"
    ]
}

我使用的是背景页面,而不是事件页面。所以也许我应该在清单中添加一些内容......

P.S。包装不适用于旧版本的扩展......更重要的是。用户报告说,在点击选项页面后,他们看到了该错误。在我的情况下没有发生,当我拖放扩展文件时,我立即看到了错误。

1 个答案:

答案 0 :(得分:0)

您需要在清单中添加指向更新网址的链接。这个论坛提到了这个问题: https://productforums.google.com/forum/?hl=en#!topic/chrome/kGgLwnrDKpQ;context-place=forum/chrome

因此,您将update_url添加到清单中。如果您没有使用该功能,它可以是任何有效的URL。像这样:

"name": "Cryptocurrency Price Tracker",
"description": "This simple extension allows you to track price changes of Bitcoin and other cryptocurrencies.",
"version": "2.5",

"icons": {
           "16":"icon16.png",
           "48":"icon48.png",
           "128":"icon128.png"
 },

"browser_action": {
    "default_icon": "icon.png",
    "default_popup": "popup.html"
},

"options_ui": {
    "page": "options.html",
    "chrome_style": true
},

"background": {
    "scripts": ["background.js"]
},
"permissions": [
    "storage",
    "notifications",
    "https://api.coinmarketcap.com/v1/*"
],
"update_url": "http://www.example.com/update.xml"
相关问题