I was able to do it in Firefox using nsIObserverService. Is there anything similar? Any link to proper documentation will be very helpful.
3 Answers
You can now set an uninstall url as of Version 41 of chrome.
https://code.google.com/p/chromium/issues/detail?id=84556
Here is the documentation. https://developer.chrome.com/extensions/runtime#method-setUninstallURL
hths, future people who read this question.
Put it in background or service worker JavaScript file chrome.runtime.setUninstallURL('your URL here');
- 
                    I suggest adding a unique identifier to the url and calling your backend to record the uninstall, followed by a redirect to some uninstall landing page or survey – Gibolt Feb 08 '17 at 06:24
 
YThere is a new api may be do this thing after the version 20.
chrome.runtime.setUninstallUrl
More datail: http://developer.chrome.com/extensions/runtime.html#method-setUninstallUrl
also has the install hook:
chrome.runtime.onInstalled
More detail: http://developer.chrome.com/extensions/runtime.html#event-onInstalled
For the browser below 20, you have to declare the permission in manifest of "management". And then bind open new tab method to the onUninstalled
More detail: http://developer.chrome.com/extensions/management.html#event-onUninstalled
- 850
 - 3
 - 9
 - 16
 
- 
                    -1: `setUninstallUrl` hasn't made it to stable Chrome yet and the `onUninstalled` event of the management API is not called for the current extension. – abyx Jan 19 '14 at 09:21
 
There are no hooks for uninstall within the Chrome extension API. Feel free to star the following feature if you want to see it included:
- 39,445
 - 10
 - 116
 - 90
 
- 
                    No, but this is easy to work around. See [FAQ Entry](http://code.google.com/chrome/extensions/faq.html#faq-firstrun) – Brian Jan 18 '12 at 17:29
 - 
                    Use first run! http://stackoverflow.com/questions/2399389/chrome-extension-first-run – Mohamed Mansour Jan 18 '12 at 18:38
 - 
                    2Good news. Looks like it's available now. https://developer.chrome.com/extensions/runtime#method-setUninstallURL – zambrey Jul 15 '15 at 20:37