Reputation: 481
<img src="images/logo.svg" onerror="this.src=images/logo.png;this.onerror=null;" id="logo">
This is not working for me in IE8, what am I doing wrong?
Upvotes: 0
Views: 1296
Reputation: 11185
if the svg exists, ie8 doesnt seem to throw an error, even if it can not display it.
using jquery and modernizr, adding this to $(document).ready() seemed to work:
$('html.no-svg img.svg').each(function() {
$(this).trigger('error').removeClass('svg');
});
Upvotes: 1
Reputation: 303441
You want this.src='images/logo.png'
with quotes to make it a string.
Upvotes: 2