I'm having an issue where setting an image src (image created with new Image
) to a base64 encoded image fails by throwing:
Cross-origin image load denied by Cross-Origin Resource Sharing policy.
I have image.crossOrigin = 'Anonymous'
already.
See the following codepen: http://codepen.io/bedeoverend/pen/aORQzg. It works in Chrome, but not in Safari. The black and white pie chart image should show up down the bottom if it worked.
Why does this happen and how can it be resolved?
UPDATE:
To clarify, I've made a more focused codepen here: http://codepen.io/bedeoverend/pen/BNGarr
It seems that setting crossOrigin = 'Anonymous'
on an image then loading in base64 fails for Safari. Both text changes to Worked...
on Chrome 44, but on Safari 8.0.3, the cross origin Anonymous one fails. EDIT: Also fails on Firefox 35 & 39.
So the question is essentially now, why, when an Image's crossOrigin property is set to 'Anonymous', does Safari fail to load base64 images in?