Skip to content

Instantly share code, notes, and snippets.

@jimmyadaro
Created June 28, 2020 08:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jimmyadaro/0cd2aebf5f0768d021263fcf4d628eee to your computer and use it in GitHub Desktop.
Save jimmyadaro/0cd2aebf5f0768d021263fcf4d628eee to your computer and use it in GitHub Desktop.
Image with retina.js fallback "onerror"
<!-- This will include a "data-rjs" attribute on the PNG (or JPG) error fallback in case the SVG failed to load -->
<!-- See: https://github.com/strues/retinajs -->
<img src="/path/to/some.svg" onerror="this.src='/path/to/some.png'; this.data-rjs='2'; this.onerror=null;">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment