There are lots of question placed on stack-overflow regrading this issue but still i am not getting any result for my issue.

I am fetching an URL(from other origin) and called in JS (to my site origin), The URL is showing correctly but the error is showing like :

Access to Image at '' from origin '' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '' is therefore not allowed access.

I have used the below code in my .htacces file, but still its not working :

<IfModule mod_headers.c>
  <FilesMatch "\.(ttf|ttc|otf|eot|woff|font.css|css|js|gif|png|jpe?g|svg|svgz|ico|webp)$">
    Header set Access-Control-Allow-Origin "*"

My test URL is :

Anybody can help me?

  • The Access-Control-Allow-Origin header needs to go on to allow your site access. If you don't control that site then you can't make requests directly to that domain in JS. – Jacob Peattie Sep 11 at 7:18
  • how is it specific to wordpress? – Mark Kaplun Sep 11 at 7:19
  • @JacobPeattie, How can i allow headers on the site, as its fetching dynamically. The fetching url can be any of the url. – Puspalata Panigrahi Sep 11 at 7:26
  • @MarkKaplun its my wordpress site and facing this issue, so that i asked here. – Puspalata Panigrahi Sep 11 at 7:27
  • You can't add headers to sites you don't control, so you can't dynamically fetch them with JS. You'll need to create an AJAX endpoint on your own site and fetch the resources from the server with PHP. – Jacob Peattie Sep 11 at 7:28

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.