我正在尝试使用 tabs.executeScript 这个 webextension-polyfill 示例来执行脚本,但收到一条错误消息: Uncaught(in Promise) 无法加载文件:“browser-polyfill.js”
这是我指的示例代码:
browser.tabs.executeScript({file: "browser-polyfill.js"});
https://github.com/mozilla/webextension-polyfill
另一个示例也是如此,我尝试在内容脚本中使用 browser-polyfill,如下所示:
"content_scripts": [{
// ...
"js": [
"browser-polyfill.js",
"content.js"
]
}]
Run Code Online (Sandbox Code Playgroud)
我收到错误消息:无法加载内容脚本的 javascript“browser-polyfill.js”。无法加载清单
它可以在后台脚本中运行,也可以在弹出的 html 中运行。
这是我的清单文件
{
"name": "Dummy",
"author": "UI Team at Dummy",
"version": "1.0.0",
"manifest_version": 2,
"description": "Vera browser extension",
"permissions": [
"storage",
"webRequest",
"tabs",
"webRequestBlocking",
"storage",
"*://*/*",
"declarativeContent"
],
"browser_action": {
"default_popup": "popup.html",
"default_icon": {
"16": "images/extension_icon16.png",
"32": "images/extension_icon32.png"
}
},
"background": {
"scripts": ["background-proprietary.js", "background.js"]
},
"content_scripts": [
{
"matches": ["https://*.box.com/*"],
"js": …Run Code Online (Sandbox Code Playgroud) google-chrome-extension firefox-addon-webextensions webextension-polyfill
目前,我正在修改我构建的 chrome 扩展,以添加在 Vue 中开发的弹出页面。我正在使用本教程https://www.streaver.com/blog/posts/create-web-extension-vue.html。
每当我尝试该步骤时vue init kocal/vue-web-extension my-extension,都会出现以下错误:
vue-cli · ENOENT: no such file or directory, scandir '/Users/avidave/.vue-templates/kocal-vue-web-extension/template'
我已将我的 vue-cli 更新到最新版本,所以我不确定这到底意味着什么。我知道文件模板不存在,但我不确定在 kocal-vue-web-extension 中创建文件的正确方法是什么,或者是否需要这样做。
google-chrome-extension vue.js vue-cli webextension-polyfill
browser.alarms我正在尝试使用Web 扩展 API创建警报。为了使扩展程序跨浏览器,我使用 webextension-polyfill 并在 Chrome 上进行测试。
我在后台脚本中创建警报的代码如下所示:
browser.alarms.create('spline-items-notification', {
periodInMinutes: 1
});
Run Code Online (Sandbox Code Playgroud)
但是,当我尝试运行此扩展时,我总是收到错误:
Uncaught TypeError: Cannot read property 'create' of undefined
Run Code Online (Sandbox Code Playgroud)
我在 manifest.json 中的后台脚本之前加载 webextension-polyfill,并且其他接口可以工作,例如browser.notifications.
我想知道如果可能的话如何解决这个问题。谢谢。
javascript google-chrome firefox-addon-webextensions webextension-polyfill