tim
tim

Reputation: 3903

dynamic SVG icon not showing in IE

I'm rendering a dynamic icon by simply setting the SRC attribute of the IMG tag to data:... Works fine in Chrome but IE won't show it.

var icn = "data:image/svg+xml;utf8,<svg width='100' height='100' xmlns='http://www.w3.org/2000/svg'><path d='m10,38.85715l31.14282,28.85715l50.28576,-56.00001' fill='none' stroke-width='20' stroke='#09f'/></svg>";

$('body').append('<img width="20" height="20" src="'+ icn +'"/>');

Fiddle:

Anyone know why IE will not render the SVG?

Upvotes: 0

Views: 504

Answers (1)

Stephen Thomas
Stephen Thomas

Reputation: 14053

Earlier versions of Internet Explorer require data uri's to be base64-encoded. I'm not sure if that's changed with IE11, but you don't specify which version of IE is causing problems.

Upvotes: 1

Related Questions