Cross Origin Resource Sharing Headers not working only for safari

强颜欢笑 提交于 2020-01-22 15:05:32

问题


I'm using rackspace to host my image files that are drawn on an html5 canvas object. Because of an HTML security feature when saving a canvas I have to use CORS (Cross Origin Resource Headers) to make save work.

I have tested my code on Chrome, IE with Chrome Frame, and Firefox, and none of them give me a security error after I added to the image request headers:

Access-Control-Allow-Origin: * 

and I have added the following attribute to all the images drawn on to the canvas

crossOrigin = "anonymous"

However, for some reason Safari still gives a security error.

SECURITY_ERR: DOM Exception 18: An attempt was made to break through the security policy of the user agent.

Any thoughts as to why this is happening on safari(desktop 5.1.7, and ipad) versions? I have checked the documentation and everything I have read says that Safari 4+ supports CORS?


回答1:


Safari 5.2 in beta solves the problem. So it looks like Safari does not yet support cors for images in released versions. The same goes for iOS safari



来源:https://stackoverflow.com/questions/10690686/cross-origin-resource-sharing-headers-not-working-only-for-safari

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!