We are looking into using Iconfu SVGInject to inject SVG files into our HTML files. One of our projects for some reason still requires support for IE8 (don't ask), so I was forced to test this with really old browsers.
There is a fallback example for no SVG support in the SVGInject docs, which looks like this (image dimensions added by myself):
<html>
<head>
<script src="svg-inject.min.js"></script>
</head>
<body>
<img src="image.svg" width="128" height="128" onload="SVGInject(this)" onerror="SVGInject.err(this, 'image.png')" />
</body>
</html>
While the fallback works on standard configuration of IE8, I found that there is no fallback for cases if neither SVG nor Javascript is supported by the browser (for example IE8 with Javascript disabled).
Here is what is displayed in the different scenarios:
Modern Browsers (Chrome, Firefox, Webkit)
The SVG is injected as an inline SVG, fully styleable
Modern Browsers, Javascript disabled
The SVG is displayed as an <img>, not styleable
Internet Explorer 8
Fallback PNG is displayed
Internet Explorer 8, Javascript disabled
Broken image is displayed
The reason why no image is displayed in the last scenario is that the onerror is never fired, therefore the fallback source attribute cannot be set.
I was wondering if there is a way (or a hack) to make the fallback image display even in cases when neither SVG nor Javascript support is available.
Note: This is more a theoretical question. Although the project requires IE8 support, I think this is some legacy requirement, as the requirements were written in 2010.