In JavaScript is there a way to see actual error a given HTMLImageElement failed to load (no codec, corrupt, not found, etc...)? Does onerror event handler have any arguments to help with this?
Asked
Active
Viewed 731 times
1
Yves M.
- 29,855
- 23
- 108
- 144
user2368632
- 990
- 1
- 12
- 33
-
1have you looked at [jQuery .error](http://api.jquery.com/error/)? – Martin Sep 04 '13 at 20:36
-
Related to https://stackoverflow.com/questions/9815762/detect-when-an-image-fails-to-load-in-javascript – Yves M. Dec 21 '21 at 17:10
1 Answers
1
Good news, it's totally possible.
Unfortunately the error event doesn't bubble correctly. You also will more than likely need to set the image's src in JS to ensure the events are bound before the error event can be thrown.
AlbertEngelB
- 16,016
- 15
- 66
- 93