首页 > 解决方案 > 使用 chrome.app.window.create 时如何截屏

问题描述

我创建了一个 chrome 应用程序并在 background.js 中打开一个新窗口,使用:

chrome.app.window.create

我想截取屏幕截图,但从我读过的内容来看,我需要使用:

chrome.tabs.captureVisibleTab

但 chrome.tabs 未定义

我有权限:

"tabs",
"activeTab"

如何截取屏幕截图?

标签: google-chrome-appgoogle-chrome-os

解决方案


检查Manifest.json文件中的权限,它应该包含

在 chrome扩展中:使用chrome.tabs.captureVisibleTab。更多信息:captureVisibleTab 选项卡activeTab

"permissions": [  
    "activeTab",  
    "tabs",  
 ],  

并在 chrome应用程序中:: 使用chrome.desktopCapture。更多信息:chrome.desktopCapture

"permissions": [  
        "desktopCapture",   
     ],

推荐阅读