QC *_*CAI 6 google-chrome-extension
我尝试将清单版本从 2 更新到 3。并且 chrome.tabs.captureVisibleTab 抛出错误
Unchecked runtime.lastError: Either the '<all_urls>' or 'activeTab' permission is required.
Run Code Online (Sandbox Code Playgroud)
由于“<all_urls>”在 Manifest 3 中不可用,因此我声明了“activeTab”权限。但这不起作用。
作为我在Background.ts中的代码
Unchecked runtime.lastError: Either the '<all_urls>' or 'activeTab' permission is required.
Run Code Online (Sandbox Code Playgroud)
清单.json
{
...,
"permissions": [
"contextMenus",
"tabs",
"activeTab"
],
}
Run Code Online (Sandbox Code Playgroud)
那么如何在Manifest 3中使用这个api进行截图呢?或者我应该使用另一个api?
有两种使用 chrome.tabs.captureVisibleTab 的方法:
声明 '<all-urls>' 权限,但在 Manifest V3 中被放弃。
声明“activeTabs”权限。但只有当用户调用Chrome 扩展文档中提到的扩展时,它才起作用。因此,如果直接使用 chrome.tabs.captureVisibleTab ,则会抛出错误。
| 归档时间: |
|
| 查看次数: |
4316 次 |
| 最近记录: |