Disable update of specific chrome extension - google-chrome

With recent news of adblock being sold to some unknown company, first thing i want to do is disable any possible update for that extension.
I've found number of questions but they are outdated. So chrome pros please tell how do we disable a specific plugin? and please take into consideration that there are many instances which synchronize it is important that the change gets synchronized to other computers, if it is not how do we do that?.
And a secondary question : where do we find sources of already installed extension? so that we could later pack and run it?

Chrome does not offer a way of disabling an update for a specific extension.
If you want to make sure that you run some specific version of an extension, you could try any of the following options:
Read-only extension folder
Go to the directory containing the extension, and mark the directory as read-only. To find that directory, visit chrome://version and look at the path at "Profile Path". The extension will then be at [value of Profile path]/Extensions/[32-character extension id].
Download the source code
Download the source code of the extension, and load it as an unpacked extension (or upload it to the Chrome Web store, and then install it).
There are several ways to get the source code (including just copying it from the directory as I mentioned at the previous step).
If you want to download a Chrome extension without installing it (e.g. because the new version contains unwanted "features" that you want to remove), then you could use my Chrome extension source viewer to download the code.
Some extensions expect to be run with a specific extension ID. You can forge this extension ID if you load the extension in unpacked mode (but you cannot upload the extension to the CWS if you do that). For instructions on fixing the extension ID, see How to change chrome packaged app id Or Why do we need key field in the manifest.json?.

Related

How to test published Chrome Extension

When I develop a Chrome Extension locally, its icon is in the browser action bar. When I install a published version of my extension, there are now two of the same icons in the browser action bar. Sometimes I can't remember which is which.
If I open an incognito browser tab, I can't seem to load any extensions. But what I want to do is test my published extension in a sandbox, where I know I have the latest version.
What is the best way to test a published extension on the same machine where you develop the extension?
One way would be to create a new profile in Chrome to test your local extension.
You can also drag and drop the browser action items, so you could move the development extension all the way to the left and the published one all the way to the right.
I currently have installed 4 versions of a Chrome extension I'm developing:
One loaded from the unpacked source files, for debugging
One loaded from the minified code in a build directory, for testing how speedy it feels in day-to-day use
The published version installed from the webstore
A completely separate test version installed from the webstore
As Matt suggests, I've rearranged the icons on the Chrome toolbar, putting the minified version on the left, then the source version, then the ones from the webstore.
But this can still be a bit confusing, so I've also changed the build process a bit. The manifest.json now sets both the name and browser_action.default_title fields to "My Extension DEV". This string is shown in the tooltip of the version I've loaded from the source directory.
During the minification process, I have the build script change these values to "My Extension OUT (build time)", so I can see when the minified version was last built in the tooltip.
The script that actually packages the minified files into a .zip file for upload to the webstore then resets these values to what the published extension should show.
You could also change these strings at runtime instead of as part of the build process. If you have a background page, it could call chrome.management.getSelf() and then check the response's installType key. If it's "development", then you could call chrome.browserAction.setTitle("DEV") to indicate in the tooltip that it's the unpacked version of the extension.

Is it possible to have a customizable Chrome (or Chromium) installation file?

I added two extensions to my google chrome that I want to send to some extern users, which are not "technical" people (I mean that they don't have IT skills). Instead of showing them how they can download and add an extension to their google chrome, I want to simplify this task by sending them an installation file of chrome (or chromium) which already contains these two extensions. So, in this case, the only thing that they have to do is just to do a normal installation (with the .exe file since they use only windows) like there are installing a normal google chrome! After that, they will have a chrome which already includes these two extensions.
Can you tall me how can I do that? because I have no idea of it..
Thank you!!
Chrome has instruction for doing this here: https://developer.chrome.com/extensions/external_extensions. You should be able to do it via a registry addition.
Note, as of Chrome 33, you will need to publish the extension to the store, and you just add update urls. Chrome does not allow installation otherwise for security reasons.

Determining if an extension was installed through Chrome Web Store or not

I noticed that in chrome://extensions you can see a "Not from Chrome Web Store" message under extensions that were installed through, e.g. drag and drop into the extensions page. Screenshot of what I am talking about:
I was wondering if there is any way of getting that information from an extension API? I have played with the chrome.extensions.management API, but the only information that gives is the installType field, which is 'normal' for both Web Store and drag and drop installs. - https://developer.chrome.com/extensions/management#type-ExtensionInfo
Am I missing something, or will we just have to wait for an update to the management API?
Could you simply check if the updateUrl property is equal to https://clients2.google.com/service/update2/crx? I believe extensions in the Chrome Web Store must have that update URL, but I'm not sure about the other way around.
Either you install by drag-and-drop or you install form web store, both are called normal install type. Ultimately, you are trying to install the .CRX file, so it means it's a normal install type. Here is the help article. Search for "installType" and read description for "normal" in mentioned article.

How to change chrome packaged app id Or Why do we need key field in the manifest.json?

I'm developing packaged app for chrome store using one-time chrome wallet payments. For my app I need to check during the runtime if user bought the app or not to decide should it be demo functionality or full functionality.
According to the chrome identity API documentation :
to keep application ID constant, You need to copy the key in the
installed manifest.json to your source manifest.
I have 2 questions about this procedure:
1) under what condition the id of my application may change? I've tried to re-install the app and made updates but the apps id remains the same.. If there is no way to change apps id than why do I need this procedure for?
2) how can I upload my zip archive with manifest.json (which contains "key" field) to chrome dashboard? The problem is that uploader throw an error at me:
An error occurred: Failed to process your item.
key field is not allowed in manifest.
Once uploaded to the Chrome Web Store, your extension ID is fixed and cannot be changed any more.
The ID is derived from the .pem file that was created the first time you (or the Chrome Web Store) packed the extension in a .crx file. When you load an extension in "unpacked mode", an ID is automatically generated in an unpredictable way. The only way to control the extension ID during development is by setting the "key" field in the manifest file, as the documentation suggests.
When you have already published the extension in the Chrome Web Store, then you can easily get the value of this "key" field using the Chrome Extension Source Viewer. After installing the extension, go to your Chrome web store details page and click on the CRX button to view the source. When the Chrome Extension Source viewer has loaded the extension, it will display the key in the console, which can directly be copy-pasted to your manifest.json:
If you have not published your extension, or you do not want to use the Chrome Web Store, then you need to generate a private key first.
Go to chrome://extensions/ and enable Developer mode.
Click on "Pack extension...", select your app/extension's directory and confirm.
Now you've got a .crx file and a .pem file. Back up the private key (.pem file)!
The extension mentioned can be used to get the same information. Alternatively, visit the online demo at https://robwu.nl/crxviewer/ and select the crx file you've just created (again: just open the console to see the "key" and extension ID).
When you're ready to submit your app/extension to the Chrome Web Store, follow the following steps:
Create a zip file containing your extension (important: manifest.json must be at the root, i.e. "directory/manifest.json" is bad, "manifest.json" is good).
Add the .pem file as key.pem!
(this is necessary to preserve the extension ID)
Upload the extension to the Chrome Web Store (without the "key" field in manifest.json, the CWS will reject any upload that contains a "key" field).
For subsequent updates, "key.pem" should not be added to the zip file, because the Chrome Web Store does not need it any more.
Hopefully somebody can give a better answer than me. An app's id is generated by google when you first upload it to the web store. However, it's not the same id that you have when developing locally. Your chrome browser generated some other id using some other mechanism.
When you are developing locally from your source code directory as an unpacked extension, and you want to use the id that the chrome web store assigned to your app, you put the "key" in your manifest and reload your app. This helps you because many APIs expect chrome.runtime.id (the id of your app) to be the same value as the app in the store. You can leave the "key" in your manifest and it will be ignored.
For anyone having problem loading the unpacked extension with the key field in the manifest.json file.
Remove your published extension if you have it in your extension list but disabled. Since otherwise your local dev extension won't load and no error will be shown. The reason being that chrome detects duplicate keys for the extension and ignores it silently.

Chrome extension id - how to find it

How can I find out what the chrome extension id is for an extension?
Use the chrome.runtime.id property from the chrome.runtime API.
You get an extension ID when you upload your extension to Google Web Store. Ie. Adblock has URL https://chrome.google.com/webstore/detail/cfhdojbkjhnklbpkdaibdccddilifddb and the last part of this URL is its extension ID cfhdojbkjhnklbpkdaibdccddilifddb.
If you wish to read installed extension IDs from your extension, check out the managment module. chrome.management.getAll allows to fetch information about all installed extensions.
If you just need to do it one-off, navigate to chrome://extensions. Enable Developer Mode at upper right. The ID will be shown in the box for each extension.
Or, if you're working on developing a userscript or extension, purposefully throw an error. Look in the javascript console, and the ID will be there, on the right side of the console, in the line describing the error.
Lastly, you can look in your chrome extensions directory; it stores extensions in directories named by the ID. This is the worst choice, as you'd have extension IDs, and have to read each manifest.json to figure out which ID was the right one. But if you just installed something, you can also just sort by creation date, and the newest extension directory will be the ID you want.
As Alex Gray points out in a comment above, "all of the corresponding IDs are actually on the extensions page within the browser".
However, you must click the Developer Mode checkbox at top of Extensions page to see them.
Extension IDs can be found in:
chrome://extensions (Chrome_Hotdog >> More_tools >> Extensions) Developer mode.
For Linux: $HOME/.config/google-chrome/Default/Preferences (json file) under ["extensions"].
All extension ID are listed here:
chrome://system