0

For example, the webserver sends back a 403 forbidden and the image fails to load. I can detect the general failure through the error event, but I want to get some more information about why. The browser obviously knows, but is there a way to get it from javascript?

Workarounds may be to try and load the image via ajax or issue a HEAD request and assume the error will reoccur. Neither seem great though.

jozxyqk
  • 16,424
  • 12
  • 91
  • 180
  • set `onerror` attribute to call a function, not sure what the first argument to the function is, check it and see – Jaromanda X Jan 14 '16 at 05:44
  • @JaromandaX first and only argument is the event. I couldn't see any error messages on it when inspecting it. – jozxyqk Jan 14 '16 at 05:45

1 Answers1

0

just open fire-bug or developers tools and look in net tab. there should be every request the browser made with corresponding response including all headers and response body. Find the call for your image and you should see what the server answer really is.

edit> oh sorry, now I see you need to get the info with javascript

or hor
  • 723
  • 3
  • 11