// This requires a png image with the same filename as the svg (function () { 'use strict'; var supportsSVG = function () { return document.implementation.hasFeature( 'http://www.w3.org/TR/SVG11/feature#Image', '1.1' ); }; if (!supportsSVG()) { $(function () { var imgs = document.getElementsByTagName('img'); $('html').addClass('no-svg'); if (!imgs.length) { imgs = document.getElementsByTagName('IMG'); } for (var i = 0, n = imgs.length; i < n; i++) { var img = imgs[i], src = img.getAttribute('src'); // is the image an svg or svgz? if (/svgz?$/.test(src)) { img.setAttribute('src', src.replace(/\.svgz?$/, '.png')); } } }); } })();