Reference: Prevent HTTP Basic Authentication from displaying prompt for images
In order to protect my user-generated content from this potential "exploit", I added crossorigin="anonymous"
to all [img]
BBCodes.
Well, it worked in IE11: when I tested the exploit, the image no longer triggered the authentication dialog (tested with cache disabled and different URLs for good measure).
But in Chrome, the exploit doesn't work... because images aren't being loaded at all. Instead I'm getting the apparently fairly common error:
Image from origin 'XXXXX' has been blocked from loading by Cross-Origin Resource Sharing policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'YYYYY' is therefore not allowed access.
Maybe my understanding is wrong, but I thought the "anonymous"
value of the attribute would allow this to work.
Am I missing something, and if so what other options are there to protect against this issue?