1

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?

Yves M.
  • 29,855
  • 23
  • 108
  • 144
user2368632
  • 990
  • 1
  • 12
  • 33

1 Answers1

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.

Here's some reading on image loading errors not bubbling.

AlbertEngelB
  • 16,016
  • 15
  • 66
  • 93