我有一个现有的chrome扩展在chrome网络商店与类似的清单。Json如下。
{
"manifest_version": 2,
"name": "Extension Name",
"short_name": "Short Name",
"description": "Some description",
"version": "1.0.83",
"icons" : {
"16": "something.png",
"32": "something.png",
"48": "something.png",
"96": "something.png",
"128": "something.png",
"512": "something.png"
},
"permissions": [ "tabs", "https://*/*", "http://*/*", "storage", "gcm" ],
"optional_permissions": [ "notifications", "webRequest", "webRequestBlocking" ],
"page_action": {
"default_icon": "styles/images/icon.png",
"default_title": "Name",
"default_popup": "popup.html"
},
"update_url": "https://clients2.google.com/service/update2/crx",
"content_security_policy": "script-src 'self' https://www.google-analytics.com https://d2xwmjc4uy2hr5.cloudfront.net; object-src 'self'",
"background": {
"scripts": ["scripts/jquery-2.1.1.min.js", "scripts/background.js"],
"persistent": true
},
"web_accessible_resources" : ["logo.png"],
"content_scripts": [
{
"js": ["scripts/jquery-2.1.1.min.js", "scripts/bigstuff.js"],
"run_at": "document_end",
"matches" : ["<all_urls>"]
}
]
}
现在我想为用户定制新选项卡页面,这需要我修改清单并添加以下详细信息。
chrome_url_overrides": {
"newtab": "newtab.html"
}
添加此将禁用现有用户的扩展?
您的扩展不会被Chrome禁用(但请参阅此答案的结尾!)。更新的扩展只有在更新引入新的权限警告(警告:此列表不完整)时才被禁用。
要查看新旧扩展生成的权限警告,请参阅扩展清单中chrome"权限"属性生成的消息的答案?
下面的注释摘自Chromium的源代码,靠近检查扩展更新是否可以在没有用户交互的情况下应用的逻辑:
// We keep track of all permissions the user has granted each extension.
// This allows extensions to gracefully support backwards compatibility
// by including unknown permissions in their manifests. When the user
// installs the extension, only the recognized permissions are recorded.
// When the unknown permissions become recognized (e.g., through browser
// upgrade), we can prompt the user to accept these new permissions.
// Extensions can also silently upgrade to less permissions, and then
// silently upgrade to a version that adds these permissions back.
//
// For example, pretend that Chrome 10 includes a permission "omnibox"
// for an API that adds suggestions to the omnibox. An extension can
// maintain backwards compatibility while still having "omnibox" in the
// manifest. If a user installs the extension on Chrome 9, the browser
// will record the permissions it recognized, not including "omnibox."
// When upgrading to Chrome 10, "omnibox" will be recognized and Chrome
// will disable the extension and prompt the user to approve the increase
// in privileges. The extension could then release a new version that
// removes the "omnibox" permission. When the user upgrades, Chrome will
// still remember that "omnibox" had been granted, so that if the
// extension once again includes "omnibox" in an upgrade, the extension
// can upgrade without requiring this user's approval.
chrome_url_overrides
权限。
当我用以下manifest.json
执行上述步骤时,
{
"name": "Permission test",
"version": "1",
"manifest_version": 2,
"chrome_url_overrides": { "newtab": "manifest.json" }
}
然后我得到一个权限对话框没有任何警告("此扩展不需要特殊权限。")。所以Chrome(测试与54和更早)不会禁用您的扩展,如果你在更新中添加此清单键。
不是意味着你现在可以发布扩展而不会失去用户。新标签页经常被用户查看,如果您未经他们的同意更改它,那么用户可以删除您的扩展,如果他们想重新控制他们的新标签页。
并仔细审查Chrome网络商店的单一目的政策:如果您,例如,开始用与您的扩展功能无关的广告加载页面替换NTP, Chrome网络商店列表可能会被商店策展人。