Firefox WebExtensions和跨域权限 [英] Firefox WebExtensions and Cross-domain privileges

查看:296
本文介绍了Firefox WebExtensions和跨域权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用相对较新的 WebExtensions

我总是收到以下错误:
$ b


-Origin请求被阻止:
同源策略不允许读取....处的远程资源(原因:缺少CORS头'Access-Control-Allow-Origin')



我添加了网站,我想访问manifest.json里面的权限部分,就像在网站上解释的那样,并且在Google Chrome浏览器上也是如此。



正常情况下,它应该这样工作,至少在 https://developer.mozilla.org/zh-CN/Add-ons/WebExtensions/Content_scripts#Cross-domain_privileges


$ b $我会的非常感谢任何帮助,因为我的想法。

解决方案

  manifest.json 
{
...
权限:[
< all_urls>
]
}


I am trying to port a chrome extension to firefox using the relatively new WebExtensions from Firefox.

I always getting the following error

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at .... (Reason: CORS header 'Access-Control-Allow-Origin' missing)

I added the website i would like to access to the permissions section inside the manifest.json like explained on the website, and also on Google Chrome its working.

Normally it should work that way, at least its explained that way on https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Content_scripts#Cross-domain_privileges

I would be very thankful for any help since I am out of ideas.

解决方案

manifest.json
{
  ... 
  "permissions": [
    "<all_urls>" 
  ]
}

这篇关于Firefox WebExtensions和跨域权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆