How to get HTTP status code of

前端 未结 5 1624
逝去的感伤
逝去的感伤 2020-12-07 01:44

I have a page with a lot of images that are generated server-side depending on user actions. And when image loads successfully I\'m happy, but when there is an error on the

5条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-07 02:05

    No, there is no way to get the HTTP status from a request made by an img tag in JavaScript.

    You could write a firefox plugin, chrome/safari extension to do that.

    An alternative would be using AJAX to load your images (not using img tags). You can get Http Status Codes from Ajax Requests.

提交回复
热议问题