我能够捕获StackOverflow w3schools.com等网站。但是在处理Google页面(Youtube,Drive等)时,它实际上不起作用。在开发阶段使用captureVisibleTab似乎有一定的限制。我是否需要先发布该应用程序才能运行?
这是代码段。
background.js
var triggerCapture = function() {
chrome.tabs.captureVisibleTab(null, {format:'png'},function(imageURI){
console.log("captureVisibleTab"); alert(imageURI) // undefined
}); };
manifest.json
{
"name": "Queue taker",
"version": "0.1",
"description": "Demonstrate screenshot functionality in the chrome.tabs api.",
"background": {
"persistent": false,
"page": "screenshot.html"
},
"browser_action": {
"default_icon": "camera.png",
"default_title": "Queue taker"
},
"permissions": "<all_urls>","tabs","activeTab"
],
"content_security_policy":"script-src 'self' https://www.gstatic.com/ https://*.firebaseio.com https://www.googleapis.com; object-src 'self'",
"manifest_version": 2
错误
:运行tabs.captureVisibleTab时未选中runtime.lastError: 由于ExtensionsSettings策略,无法对该页面进行脚本化。 在triggerCapture(chrome-extension://jciafjhdkmanfegbanccjagihhegecpo/background.js:17:17) 在chrome-extension://jciafjhdkmanfegbanccjagihhegecpo/background.js:24:5