Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firefox WebExtensions and Cross-domain privileges

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.

like image 215
Chris Avatar asked Apr 14 '16 17:04

Chris


People also ask

Does Firefox allow CORS?

CORS or Cross Origin Resource Sharing is blocked in modern browsers by default (in JavaScript APIs). Installing this add-on will allow you to unblock this feature. Please note that, when the add-on is added to your browser, it is in-active by default (toolbar icon is grey C letter).

How do I unblock CORS in Firefox?

A user can toggle the extension on and off from the toolbar button. To modify how these headers are altered, use the right-click context menu items. You can customize what method are allowed. The default option is to allow 'GET', 'PUT', 'POST', 'DELETE', 'HEAD', 'OPTIONS', 'PATCH' methods.

How do I turn off Origin Policy in Firefox?

In about:config add content. cors. disable (empty string).

What is cross-origin request?

Cross-Origin Resource Sharing (CORS) is an HTTP-header based mechanism that allows a server to indicate any origins (domain, scheme, or port) other than its own from which a browser should permit loading resources.


1 Answers

manifest.json
{
  ... 
  "permissions": [
    "<all_urls>" 
  ]
}
like image 99
sonichy Avatar answered Nov 04 '22 02:11

sonichy