Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Inline SVG Content not displaying in IE Screenshot

I'm working on a thumbnailer whereby a service takes thumbnail images of HTML content in a form-less IE9 control. Everything is working smoothly with a DrawToBitmap call along with a couple of GDI calls, but SVG content is not displaying. Everything else seems to display just fine, but no SVG.

I figure that this has something to do with how SVG is implemented in IE, but I don't know the details. Any thoughts?

TIA.

like image 237
Chris B. Behrens Avatar asked May 24 '11 14:05

Chris B. Behrens


2 Answers

The answer came from Ted Johnson of IEBlog:

IE9 has no separate SVG engine; it’s all one DOM and rendering pipeline. However, if your document isn’t in 9 standards document mode, you’ll not get any SVG content. I think, by default, the WebBrowser control in .NET defaults to compatibility mode. Try adding a meta tag to the top of your HTML page to force IE9 mode:

<meta http-equiv="X-UA-Compatible" content="IE=9">

This, indeed, turned on SVG rendering like a light switch.

like image 125
Chris B. Behrens Avatar answered Oct 19 '22 23:10

Chris B. Behrens


You can also set a doctype of HTML4 strict or HTML5.

<!DOCTYPE HTML>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

From http://www.seowarp.com/blog/2011/06/svg-scaling-problems-in-ie9-and-other-browsers/ :

Before I begin, I’d just like to point out that on my test page, Internet Explorer 9 refused to display any of my SVG images on a basic HTML page until I declared the HTML4 strict or HTML5 doctypes.

like image 1
Steve Eynon Avatar answered Oct 19 '22 23:10

Steve Eynon