Google Chrome not respecting value of key in manifest.json?

Viewed 816

I am developing a Chrome extension that uses Native Messaging. Part of the requirements for developing such an extension is that the extension's ID does not change.

The documentation for the key entry in manifest.json states the following:

This value can be used to control the unique ID of an extension, app, or theme when it is loaded during development.

Therefore, I added the key to manifest.json as follows:

{
    "manifest_version": 2,
    "key": "cljjpoinofmbdnbnpebolibochlfenag",
    ...
}

I then visited chrome://extensions and clicked "Load unpacked extension..." to browse to the directory containing the extension's code. However, the ID assigned does not match the one that I specified:

enter image description here

What am I doing wrong?

1 Answers

It appears that the wording is a bit misleading in this sentence:

"This value can be used to control the unique ID of an extension, app, or theme when it is loaded during development."

Although the value controls the unique ID, it is not the unique ID itself. To find the correct value of the key, you will need to:

  • Install the extension from the Chrome Web Store
  • Open your user profile directory and examine:

    Extensions/[id]/[version]/manaifest.json
    
  • Copy the value for key from the file

After doing this, the unpacked extension should now be assigned the correct ID.

Related