how to get alphanumeric extensions id for chrome [duplicate] - google-chrome

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Google Chrome - Alphanumeric hashes to identify extensions
I have written one chrome extension and I am packaging it using --pack-extension switch , it is giving me one .crx file and one .pem file. Now I wanted to install this extension on my deployment machine using windows registry, for that I wanted to know how do I get the extension id(which we get if drag and drop .crx file to chrome://extensions tab).

Extension Info of chrome.management API() fetches extension id. However onInstalled() event returns all Extension Info of extension installed.
Ex:
If extension id after packaging turns out to be kpddfdhkifopcepoldlgidejfnbhdbdn, it will be same where ever it is hosted.
Let me know if you need more information.

Related

Which file does Chrome save cookies in? [duplicate]

This question already has answers here:
Where does Chrome store cookies?
(9 answers)
Closed 2 years ago.
I am trying to create a script for adding or removing cookies in Chrome before opening the browser.
I know that cookies are stored somewhere in the patch:
"C:\Users\user\AppData\Local\Google\Chrome\User Data"
but there are thousands of files inside User Data...
Does anyone know the name and direct path where cookies are stored?
I found the answer to my question:
C:\Users\your_username\AppData\Local\Google\Chrome\User Data\Default
You'll need a program like SQLite Database Browser to read it.
For Mac OS X, the file is located at :-
~/Library/Application Support/Google/Chrome/Default/Cookies

Disable update of specific chrome extension

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?.

Keep chrome extension id same during development [duplicate]

This question already has answers here:
Obtaining Chrome Extension ID for development
(3 answers)
Closed 7 years ago.
I am trying to test my chrome extension on different machines, and I saw that the extension id changes every time since I am loading it as an unpacked extension.
But, I really need to maintain the same extension id. My extension goes through OAuth 2.0 with an external non-Google provider. When I registered my extension with the external provider, I had provided the redirect URI in the form of
chrome-extension://<extension-id>/callback.html If I load the unpacked extension again, the id changes and my app no longer works as the redirect URI changes. It's practically unfeasible to keep changing the redirect URI. How do I maintain the same id?
You need to set the key in the manifest file, based on your generated pem file.
There's instruction on getting the pem here: https://developer.chrome.com/extensions/packaging
And there's more detail on the key field here: https://developer.chrome.com/extensions/manifest/key
Make sure you save your pem file once you generate it! It can never be generated again, and you'll have to republish your app to get a new one.

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.

navigator.geolocation.getCurrentPosition not allowed on "file:///C:/" based access [duplicate]

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
HTML 5 Geo Location Prompt in Chrome
I've been looking at geolocation in Html 5. I'm using Chrome (12) and am accessing the html file using a path like this: file:///C:/_Development/Examples/Html5/boilerplate.html
I'm getting the little geolocation icon in the search bar that says that the location has been blocked from tracking your location.
Note that I don't have any exceptions setup at all...
Can this be done or do I need to host the file on a web server? If it can't be done, why can't it be done?
Thanks
This is a duplicate of this question:
HTML 5 Geo Location Prompt in Chrome
It seems that chrome has security restrictions on accessing geolocation data locally. You need to host the file to use the data. A workaround with python is available in the previous question.