Chrome扩展程序已损坏

问题描述 投票:0回答:1

我的扩展有问题。当我从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/*"
    ]
}

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

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

google-chrome google-chrome-extension corrupt
1个回答
0
投票

您需要在清单中添加指向更新URL的链接。这个论坛提到了这个问题: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"
© www.soinside.com 2019 - 2024. All rights reserved.