边缘不支持 API 调用'tabs.captureVisibleTab'



我在Windows 10 V1703上使用Edge,构建15063.296。文档(https://learn.microsoft.com/en-us/microsoft-edge/extensions/api-support/support--apis(epapi api tabs.capturevisibletab可用。

但是当我在后台脚本中使用它时,我会收到以下错误:

api调用'tabs.capturevisibletab'不支持边缘。

代码是:

browser.tabs.captureVisibleTab(currentTab.windowId, {format: "png"}, function (data) {});

我错过了什么吗?

更新:

这是我的清单文件(从Chrome移植(:

{
"author": "Evgeny Suslikov",
"background": {
    "page": "background.html",
    "persistent": true
},
"browser_action": {
    "default_icon": {
        "19": "images/sss_19.png"
    },
    "default_title": "FireShot - Capture page",
    "default_popup": "fsPopup.html"
},
"commands": {
    "last-used-action": {
        "suggested_key": {
            "default": "Ctrl+Shift+Y",
            "mac": "Command+Shift+Y"
        },
        "description": "__MSG_options_label_last_action_hotkey__"
    }
},
"default_locale": "en",
"description": "__MSG_application_description__",
"icons": {
    "16": "images/sss_16.png",
    "32": "images/sss_32.png",
    "48": "images/sss_48.png",
    "128": "images/sss_128.png"
},
"Key": "B5SSrXXpDZAoT8SQ4vAzNeTQ1tBC2Z24nx+hHZXfykmVYfMy5aOwPkf0Hbt7SXlKbprwV0GwrYgCwIDAQAB",
"manifest_version": 2,
"name": "__MSG_application_title__",
"offline_enabled": true,
"optional_permissions": [
    "tabs",
    "<all_urls>",
    "downloads"
],
"options_page": "fsOptions.html",
"permissions": [
    "activeTab",
    "tabs",
    "contextMenus",
    "nativeMessaging"
],
"short_name": "FireShot",
"version": "0.98.92",
"web_accessible_resources": [
    "images/*.gif"
],
"-ms-preload": {
    "backgroundScript": "backgroundScriptsAPIBridge.js",
    "contentScript": "contentScriptsAPIBridge.js"
},
"content_scripts": [{
    "matches": ["<all_urls>"],
    "js": ["scripts/fsUtils.js", "scripts/fsSelection.js", "scripts/fsLinks.js", "scripts/fsContent.js"]
}]
}

在我的fsbackground.js页面中,我致电:

     browser.tabs.captureVisibleTab(windowId, {format: "png"}, function (data) {});

我收到以下错误:单击以查看屏幕截图...

该功能从Edge 15开始支持。在以前的版本上,它仍然没有支持,即使文档说的话有所不同。

确保下载最新版本的Microsoft Edge扩展工具包,并使用它再生桥梁文件。

您可以查看生成的bougchscriptsapibridge.js文件以查看发生了什么。

上一个版本(未支撑(:

captureVisibleTab(windowId, options, callback) {
    bridgeLog.LogUnavailbleApi("tabs.captureVisibleTab");
}

新版本(支持(:

captureVisibleTab(windowId, options, callback) {
    bridgeLog.DoActionAndLog(() => {
        myBrowser.tabs.captureVisibleTab.apply(null, arguments);
    }, "tabs.captureVisibleTab");
}

相关内容

  • 没有找到相关文章

最新更新