chrome 扩展清单文件中的 "content_capabilities" 字段是什么?
What is "content_capabilities" field in chrome extension's manifest file?
我搜索了 Chrome 扩展清单文档文档 (https://developer.chrome.com/extensions/manifest),有一个“content_capabilities”,但没有 link。
我推断它为“匹配项”提供了“权限”,如下所示。
"content_capabilities": {
"matches": [ "https://docs.google.com/*", "https://drive.google.com/*" ],
"permissions": [ "clipboardRead", "clipboardWrite", "unlimitedStorage" ]
},
但是每当我尝试在我的本地示例扩展中使用这种格式时,我都会收到这个错误。
'content_capabilities' is not allowed for specified extension ID
这种格式能用在普通用户身上吗?
确实,它向匹配的网站授予指定权限
指定 URL 模式。这里是 why it was implemented:
Some hosted apps are used primarily to grant websites clipboardRead and clipboardWrite permissions, e.g. the Drive default hosted app. As part of the platform's move away from hosted apps, extensions should have the ability to grant these permissions to verified websites. These permission grants should be explicitly specified in the extension's manifest and displayed to users on extension install.
限于list of a few verified extensions (Google Drive and a few unnamed ones that could be internal Google extensions) but the restriction is applied only in the stable Chrome so you can use it in beta/dev/Canary channels [source]。
在过去(甚至今天,如果您针对的是旧浏览器),如果像文本编辑器这样的网站想要能够访问剪贴板或无限存储,用户必须安装一个单独的该网站的托管应用程序,其唯一目的是授予这些权限。托管应用程序很久以前就被弃用了(尽管仍然受支持),所以这个 content_capabilities
键暴露给了扩展。
Web平台已经支持异步了,这个东西已经过时了Clipboard API and Persistent Storage API。
我搜索了 Chrome 扩展清单文档文档 (https://developer.chrome.com/extensions/manifest),有一个“content_capabilities”,但没有 link。
我推断它为“匹配项”提供了“权限”,如下所示。
"content_capabilities": {
"matches": [ "https://docs.google.com/*", "https://drive.google.com/*" ],
"permissions": [ "clipboardRead", "clipboardWrite", "unlimitedStorage" ]
},
但是每当我尝试在我的本地示例扩展中使用这种格式时,我都会收到这个错误。
'content_capabilities' is not allowed for specified extension ID
这种格式能用在普通用户身上吗?
确实,它向匹配的网站授予指定权限 指定 URL 模式。这里是 why it was implemented:
Some hosted apps are used primarily to grant websites clipboardRead and clipboardWrite permissions, e.g. the Drive default hosted app. As part of the platform's move away from hosted apps, extensions should have the ability to grant these permissions to verified websites. These permission grants should be explicitly specified in the extension's manifest and displayed to users on extension install.
限于list of a few verified extensions (Google Drive and a few unnamed ones that could be internal Google extensions) but the restriction is applied only in the stable Chrome so you can use it in beta/dev/Canary channels [source]。
在过去(甚至今天,如果您针对的是旧浏览器),如果像文本编辑器这样的网站想要能够访问剪贴板或无限存储,用户必须安装一个单独的该网站的托管应用程序,其唯一目的是授予这些权限。托管应用程序很久以前就被弃用了(尽管仍然受支持),所以这个 content_capabilities
键暴露给了扩展。
Web平台已经支持异步了,这个东西已经过时了Clipboard API and Persistent Storage API。