我的后台脚本中的以下网络扩展代码在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");