What is the difference between Image.onabort and Image.onerror?
I understand that Image.onabort
or Image.onerror开发者_JAVA百科
fires if image was not loaded successfully. But when is fired which? Can they fire both in some circumstances?
Abort generally comes from a user action. For example if image A hasn't finished loading, but the user hits a JavaScript button that switches the "src" to image B. Then image A would get an "abort" event. I think if you hit the stop button it would trigger the "abort" event as well. Error events would come from a bad file or something like that that prevents the file from loading.
I would guess that it's possible for them both to fire, but I would also guess that it would be rare.
精彩评论