Remove Chrome extension via code
An extension can remove itself by calling chrome.management.uninstallSelf();
.
If your extension wants to remove another extension, declare the management
permission in the manifest file and call chrome.management.uninstall('<id of other extension>');
.
You cannot uninstall an extension from the command line any more as of Chrome 36.0.1960.0 (using --uninstall-extension
, crbug 351294).
If anyone is looking for an alternative to --uninstall-extension
, here is a try:
sadly this doesn't work from command line, but you can be used to programmatically do stuff with extensions.
manifest.json
{
"manifest_version": 2,
"name": "Uninstaller",
"version": "1.0",
"description": "Uninstalls hardcoded extensions.",
"permissions": [ "management" ],
"browser_action": { },
"background": { "scripts": ["background.js"] }
}
background.js
chrome.browserAction.onClicked.addListener(function(tab) {
chrome.management.uninstall('ckibcdccnfeookdmbahgiakhnjcddpki');
chrome.management.uninstallSelf();
});
Usage
- Save the above two files to a new folder
- Change the ID of the extension you want to uninstall in
background.js
- Open chrome://extensions (or Menu > Settings > Extensions)
- Tick Developer mode
- Click Load unpacked extension
- Browse the folder you saved the files to
- Click the new icon that appears next to the hamburger menu
in the top right corner (puzzle piece) - Untick Developer mode
- Delete the folder with the two files