简体   繁体   中英

Safari image.onload event not firing with Blob url

I am trying to get this demo from MDN working in Safari. It works quite nicely in Chrome and FF.

Specifically, the onload callback of the image does not appear to be firing in Safari 7.0.3. Here's a jsfiddle that demonstrates this behavior (run it with the dev console in your browser open):

http://jsfiddle.net/qrohlf/HGFZ4/1/

I think that this is probably a bug in Safari - any ideas on how to work around it?

In your jsfiddle example, the onload event is not fired because an error has occurred. Try attach an onerror handler and you will see it fired.

Unfortunately, the error object doesn't tell you what is wrong.

Indeed the problem is the Blob 's type doesn't expect the charset part. Try removing ;charset=utf-8 and it will work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM