Is there a way to get extension id in a chrome extension? - google-chrome-extension

I want to get extension id of my chrome extension in extension codes. I know that extension id is a fixed string after being published to web store. But before it is published, the id changes when loaded from local folder. If I can get the id in codes, it will make debugging and testing much easier.

chrome.runtime.id works! Thanks to #Robbi,
More info about propertyId can be found over Chrome Docs

Related

How can I get new chrome extension id before submit it for review?

I have developed one extension which takes session of my site by opening site in new tab and my site is talk with my chrome extension.
For send message from my website to chrome extension. I used my extension's id into my website.
I generate that extension id for development purpose only. Now I want to publish my extension and want to submit for review.
But problem is that , without my website., extension won't work as expected. So I need new extension id that will be generate after publish on Chrome Web Store and then I have to update my website to update id of extension into my website.
So how can I get uploaded extension's id before submit for review. So that I can update my website first before extension going for review.
Does any one have same kind of scenario ?
I don't know how google review our extension. So it needs to be working perfect before submit it in review.
You could upload the Extension to the Chrome Store but without publishing.
Then you could download it from the Chrome Dashboard.
Extract crx file. It is an ZIP File or use an Crx Viewer. (https://robwu.nl/crxviewer/)
the manifest.json should now contain a "Key" entry.
(https://developer.chrome.com/docs/extensions/mv3/manifest/key/)
Ensure that the Key is the same value for your local build. This should result into the same id.
When you Upload the Extension to the Chrome Store again, ensure that the Key entry is removed. Otherwise the Chrome Dashboard will reject the Upload.

Develop a chrome extension to capture clicks using chrome extension api

I am trying to develop a chrome extension which can capture clicks using chrome extension APIs not by JavaScript.
If you want to capture the 'click' events in chrome extension, this answer might help you from the question - How may I get the element attributes (text, id, class and so on..) of the current tab, out of a mouse click, from a chrome extension?
In your content.js, write the following code-
$(window).click(function(event) {
console.log("Click event: ", event);
});
Content scripts are files that run in the context of web pages. By using the standard Document Object Model (DOM), they are able to read details of the web pages the browser visits, make changes to them and pass information to their parent extension.

Create a new SessionID with Chrome Extension

I have read this page about chrome.sessions and searched the web, but I cant find how I can change the sessionID or create a new one within a Chrome Extension.
Regards, Peter
You can't do this. A session is started at the browser launch.

How to get chrome extension ID in dev and production?

I work on a chrome extension.
I do use some messages between my web page and background process.
Problem is: the ID of my application is different when it comes from the google extension page and the one I locally work on and debugging.
Is there a way to make both ID same so debug and production version can communicate ?
Find it in the webstore developer dashboard. Click the more info button. Copy the "Public key". Add a "key" item to manifest.json. Paste the string value to key. Like this: "key": "yourPublicKey"

How to save user information in a chrome extension

Im making a chrome extension. I need the user to be assigned a unique id they get from my web site. how do i save this information in my chrome extension so that each time the browser is started the extension has the same unique id?
Use local storage, it's persistent across sessions.

Resources