Skip to content Skip to sidebar Skip to footer

How To Solve Cross-origin Request Blocked Error In Firefox

When I am usi

Solution 1:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at the url. This can be fixed by moving the resource to the same domain or enabling CORS.

It means you should have api (url in your code) and the file which has your script must be in same domain

Or

Add the Access-Control-Allow-Origin header in the API(url in your code) domain

<FilesMatch "\.(php)$"><IfModulemod_headers.c>
    Header set Access-Control-Allow-Origin "*"
  </IfModule></FilesMatch>

* to allow all cross domainrequests

Solution 2:

<FilesMatch "\.(php)$"><IfModulemod_headers.c>
    Header set Access-Control-Allow-Origin "*"
  </IfModule></FilesMatch>

I added this to my httpd-vhosts.conf and the error was solved

Post a Comment for "How To Solve Cross-origin Request Blocked Error In Firefox"