Closed anteksiler closed 10 years ago
You must serve the images with an appropriate Access-Control-Allow-Origin header.
So this change must be done on cdn servers?
I am using wpengine.com and they work with maxcdn. I'll email them and check if they can make cdn configuration changes per client.
Yes. Let me know if it works!
Hi @kennethcachia I did add CORS headers to the CDN we are using but still getting the error. You can check our demo here: http://north.fuelthemes.net/
curl -I http://cdn.fuelthemes.net/wp-content/uploads/2014/09/bg.jpg returns: Content-Type: image/jpeg Content-Length: 51637 Connection: keep-alive Last-Modified: Sat, 06 Sep 2014 10:43:23 GMT X-Type: static/known Cache-Control: public, max-age=2592000 Vary: Accept-Encoding Access-Control-Allow-Origin: Accept-Ranges: bytes Server: NetDNA-cache/2.2 Access-Control-Allow-Origin: X-Cache: MISS
Check this out: http://jsfiddle.net/w7yb1km1/
It works when you add the crossorigin attribute to the image. More details and demo: http://www.kennethcachia.com/background-check/cross-origin.html
Is there anyway we can set this property inside BC source file? I tried img.crossOrigin('*'); but didnt work
This is what I used:
list[e].img.setAttribute('crossorigin', 'anonymous');
also tried
list[e].img.setAttribute('crossorigin', '');
Works if we set the crossorigin attribute first and then load the image. Can you use this approach?
Is there anyway we can run images from a CDN without getting the cross origin error?