Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

添加Firefox支持 #16

Open
zsbai opened this issue May 19, 2023 · 0 comments
Open

添加Firefox支持 #16

zsbai opened this issue May 19, 2023 · 0 comments

Comments

@zsbai
Copy link

zsbai commented May 19, 2023

尝试自己转换了一下出错,问了chatgpt貌似需要修改一些api

这个错误是因为 Firefox 和 Chrome 在拓展插件的实现上存在一些差异,导致某些 API 的支持不同。其中 "/background/service_worker" 是 Chrome 所支持的,但并不被 Firefox 支持。换句话说,你的代码中使用了这个 API,所以在 Firefox 上运行时就会报错。

要解决这个问题,你需要找到替代品或者调整你的代码适应 Firefox 的 API。一种可能的解决方案是使用 Firefox 支持的 background scripts 代替 service worker。具体来说,你可以创建一个名为 background.js 的文件,并将其在 manifest.json 中声明为 background.scripts,像这样:

"background": {
  "scripts": ["background.js"]
}

然后在 background.js 中编写你需要的代码。请注意,Firefox 的 background scripts 与 Chrome 的 service worker 有许多不同之处,因此你需要仔细阅读文档以确保你的代码正确运行。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant