4 ms·
According to Eisenberg & Bellamy-Royds' (excellent) "SVG Essentials", you should be able to create a fallback by using an <object> tag. Assuming that works (I
by dmlorenzetti 12y ago
According to Eisenberg & Bellamy-Royds' (excellent) "SVG Essentials", you should be able to create a fallback by using an <object> tag. Assuming that works (I haven't tried it), it could be a more direct approach than Javascript.
The <object> element is the general-purpose way of embedding external files in HTML and XHTML... Any content in between the [start and end tags] will be rendered only if the object data itself cannot be displayed.
- organsnyder 12y agoInteresting idea, and I don't doubt that it would work (though I also haven't tried it). I prefer to keep my HTML semantic when I can, and <img/> is more accurate than <object/>. Since SVG support is now over 90% of deployed browsers, I'd rather use Javascript for the edge cases.
- lysyi3m 12y agoIt seems that using of <object> - not the best solution. For example in construction like <object data="image.svg" type="image/svg + xml"> <img src="fallback_image.jpg" /> </object> fallback image will always be loaded. To avoid this you need to use additional tricks like conditional comments... We need some more elegant trick to do that :)