OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

How to get HTTP status code of <img> tags

  • Thread starter Thread starter Artem Pianykh
  • Start date Start date
A

Artem Pianykh

Guest
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 server I have to act according to what an error occurred.

For example:

  • 500 code: do this stuff.
  • 503 code: do that stuff

and so on.

So, my question: is there any way to get status code within "img" tag on-error event handler?

<p>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 server I have to act according to what an error occurred.</p>

<p>For example: </p>

<ul>
<li>500 code: do this stuff.</li>
<li>503 code: do that stuff</li>
</ul>

<p>and so on.</p>

<p><strong>So, my question</strong>: is there any way to get status code within "img" tag on-error event handler? </p>
 

Latest posts

Online statistics

Members online
0
Guests online
5
Total visitors
5
Top