Firefox WebExtensions and Cross-domain privileges

你说的曾经没有我的故事 提交于 2019-12-09 10:57:45

问题


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.


回答1:


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



回答2:


I think you need to add a CSP header to your HTML page. http://content-security-policy.com/ I had to add one to get mine to work with a similar warning.



来源:https://stackoverflow.com/questions/36629635/firefox-webextensions-and-cross-domain-privileges

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!