来自chrome docs我可以看到可以使用以下代码订阅“已安装”和“已更新”事件:
chrome.runtime.onInstalled.addListener function(){
// do something when the app is installed
}
我的问题是:是否有一些时间可以订阅用户决定卸载应用程序的事件?即类似:
chrome.runtime.onUninstall.addListener function(){
// do something when the app is installed
}
最佳答案
看起来最好的选择是这样的:
chrome.runtime.setUninstallURL(字符串网址)
Sets the URL to be visited upon uninstallation. This may be used to clean up server-side data, do analytics, and implement surveys. Maximum 255 characters.
关于javascript - 如何在 Chrome 应用程序被卸载之前运行代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22182284/