As was pointed out in a comment, <img src="home-1x.png" srcset="icons/home.svg 1x" alt="Home">
works (for SVG; not in general).
If you want to support pre-srcset browsers, you can use
<object type="image/svg+xml" data="icons/home.svg">
<img src="home-1x.png" alt="Home">
</object>
But this has some issues, too: both resources will be loaded, the object
acts more like an iframe
than like an img
(you can select text in the SVG, it can execute scripts, navigate, etc).
Another classic is using onerror
like this:
<img src="icons/home.svg" onerror="this.onerror=null; this.src='home-1x.png';" alt="Home">
This has the drawback that non-SVG browsers will unnecessarily load the SVG, and users without scripting and without SVG support will not load any image. I suppose that's not much of a problem.
Finally, you can use the picture
markup and pull in http://scottjehl.github.io/picturefill/ and then it should just work (for users with scripting enabled).