在插件安装时打开 Web 扩展 url 在 Opera 和 Chrome 上工作正常但在 Firefox 上失败?
Web-extension opening url on addon install works fine on Opera and Chrome but fails on Firefox?
我的后台脚本中的以下网络扩展代码 background.js
在 Opera 上工作正常,Chrome 在安装、更新和卸载时触发适当的网页,但在 firefox 中什么都不做。同样在此处显示为兼容 - https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/runtime/onInstalled
Manifest.json
有:
"background" : {
"scripts" : ["includes/background.js"]
},
background.js
有:
//CHECK INSTALL, UPDATE, UNINSTALL
chrome.runtime.onInstalled.addListener(function (details) {
if (details.reason == "install") {
chrome.tabs.create({
url : "https://www.example.com/install.html"
});
}
if (details.reason == "update") {
chrome.tabs.create({
url : "https://www.example.com/update.html"
});
}
});
chrome.runtime.setUninstallURL("http://www.example.com/uninstall.html");
您已将附加组件安装为 temporary add-on through about:debugging
. The documentation states:
This event is not triggered for temporarily installed add-ons.
因此,事件不会触发。您需要将附加组件安装为普通的非临时附加组件。您可以通过多种方式来做到这一点。官方的方式是安装Firefox Developer Edition, or Firefox Nightly and set xpinstall.signatures.required
to false
in about:config
. If you want to do so in the release version of Firefox, you can 。 linked 答案(也在下面列出)中描述了这样做的过程。您还可以在下面的文档 link 中找到有助于将您的附加组件安装为普通附加组件的信息。
- Installing add-ons for development(Stack Overflow 文档的存档)
我的后台脚本中的以下网络扩展代码 background.js
在 Opera 上工作正常,Chrome 在安装、更新和卸载时触发适当的网页,但在 firefox 中什么都不做。同样在此处显示为兼容 - https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/runtime/onInstalled
Manifest.json
有:
"background" : {
"scripts" : ["includes/background.js"]
},
background.js
有:
//CHECK INSTALL, UPDATE, UNINSTALL
chrome.runtime.onInstalled.addListener(function (details) {
if (details.reason == "install") {
chrome.tabs.create({
url : "https://www.example.com/install.html"
});
}
if (details.reason == "update") {
chrome.tabs.create({
url : "https://www.example.com/update.html"
});
}
});
chrome.runtime.setUninstallURL("http://www.example.com/uninstall.html");
您已将附加组件安装为 temporary add-on through about:debugging
. The documentation states:
This event is not triggered for temporarily installed add-ons.
因此,事件不会触发。您需要将附加组件安装为普通的非临时附加组件。您可以通过多种方式来做到这一点。官方的方式是安装Firefox Developer Edition, or Firefox Nightly and set xpinstall.signatures.required
to false
in about:config
. If you want to do so in the release version of Firefox, you can
- Installing add-ons for development(Stack Overflow 文档的存档)