Search code examples
ajaxsvgxml-parsingdomparser

Cross-Browser XML Insert


I need to insert an XML (svg) file's contents into an html div. For browsers that don't support DOMParser() (IE7 & 8), how can I do this?

It appears that in IE8 I can insert the xml contents as text using innerHTML, but it doesn't render the svg.

My work is online at http://ec2-174-129-62-227.compute-1.amazonaws.com:8080/ but it may change a little bit as I tweak solutions. Make sure you click the "Leafy Tree" radio button. If it's functional, it should work fine in IE9 and chrome.


Solution

  • IE8 and lower doesn't support SVG, so even if you manage to insert the elements it still won't render.