我最近卸载了一个 Chrome 扩展,当我删除它时,它打开了一个新页面,这是一个需要我填写的调查。我一直在阅读 Chrome 开发者文档,但似乎无法找到如何执行此操作。有什么建议吗?
扩展名为 Delight for Chrome,地址为 https://chrome.google.com/webstore/detail/delight-for-chrome/hehbgjdnbibkndghdlilefececadokpb
最佳答案
使用chrome.runtime.setUninstallURL .
chrome.runtime.setUninstallURL("https://your-survey-site.com", function() {
var lastError = chrome.runtime.lastError;
if (lastError && lastError.message) {
console.warn(
"Unable to set uninstall URL: " + lastError.message
);
} else {
// The url is set
}
});
请注意,在卸载扩展之前不会调用回调,但是当设置了卸载扩展的 url 时。
您无法监听来自扩展程序的卸载事件(除非您有第二个扩展程序来执行此操作...)以在卸载前执行一些操作,例如清理。
关于google-chrome-extension - 卸载 Chrome 扩展时打开新窗口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38469035/