Last active
May 25, 2018 05:07
-
-
Save digamber89/78cd64d27b31d5f88a5f1916691f1ac2 to your computer and use it in GitHub Desktop.
Alternate image if image returns 404 or not found
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
function imgError(image) { | |
image.onerror = ""; | |
image.src = "link-to-backup-image.svg"; | |
return true; | |
} | |
</script> | |
<img src="some-image-url.jpeg" onerror="imgError(this);" > |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment