Ajax No Access-Control-Allow-Origin using type 'HEAD'

- 1 answer

Ad

I ran into this problem when using this solution to check if the image is valid.

However I get a

No Access-Control-Allow-Origin error

, and I have no access to the image server.

Any help will be appreciate!

Ad

Answer

Ad

The problem lies within JS policy not to allow cross-origin (or to put it simple - cross-domain) requests to prevent intrusions etc. If the server does not allow cross-origin requests (using specific headers in communication), you won't be able to get your image even if it exists.

This and this should enlighten you a bit.

Ad
source: stackoverflow.com
Ad