On my images I'm setting the onerror
attribute so that a placeholder is used in case the image is not available for some reason:
<img
class="article-img"
src="path-to-image.jpg"
alt="some description"
onerror="this.src='/images/fallback.png'"
>
Now, it looks like onerror
has been deprecated, but I couldn't find any good source on what would be the suggested alternative way of handling the error (possibly in a similarly compact fashion).
It would be also interesting to know why it was deprecated.