问题
I'm developing a Chrome extension for bookmarks. In the application, I make use of chrome.storage.sync. However, when I'm testing to install the application from a zip file I get different app id:s. This seems to affect sync and thus I'm wondering if there is a way to work around this.
回答1:
You need to set the appropriate value for the key
property in your manifest (and make sure you always use the same .pem file for packaging your extension).
Quoting the docs on manifest's key
property:
This value can be used to control the unique ID of an extension, app, or theme when it is loaded during development.
To get a suitable key value, first install your extension from a .crx file (you may need to upload your extension or package it manually). Then, in your user data directory, look in the file
Default/Extensions/<extensionId>/<versionString>/manifest.json
. You will see the key value filled in there.
来源:https://stackoverflow.com/questions/20970833/does-chrome-app-id-for-extensions-affect-sync-storage