oceanic815
oceanic815

Reputation: 481

SVG fallback for IE8 inline attempt

<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

Answers (2)

commonpike
commonpike

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

Phrogz
Phrogz

Reputation: 303441

You want this.src='images/logo.png' with quotes to make it a string.

Upvotes: 2

Related Questions