我正在开发一个使用 Native Messaging 的 Chrome 扩展程序.开发此类扩展的部分要求是扩展的 ID 不会更改。
The documentation for the key
entry in manifest.json
陈述如下:
This value can be used to control the unique ID of an extension, app, or theme when it is loaded during development.
因此,我将 key 添加到 manifest.json
中,如下所示:
{
"manifest_version": 2,
"key": "cljjpoinofmbdnbnpebolibochlfenag",
...
}
然后我访问了 chrome://extensions
并单击“加载解压的扩展...”以浏览到包含扩展代码的目录。但是,分配的 ID 与我指定的 ID 不匹配:
我做错了什么?
最佳答案
看来这句话的措辞有点误导:
"This value can be used to control the unique ID of an extension, app, or theme when it is loaded during development."
虽然值控制唯一 ID,但它并不是唯一 ID 本身。要找到 key 的正确值,您需要:
- 从 Chrome 网上应用店安装扩展程序
打开您的用户配置文件目录并检查:
Extensions/[id]/[version]/manaifest.json
从文件中复制
key
的值
完成此操作后,现在应该为解压的扩展分配正确的 ID。
关于google-chrome - Google Chrome 不尊重 manifest.json 中的键值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47103009/