labrassbandito
labrassbandito

Reputation: 535

jQuery SVG's load function not compatible with IE 8

I am loading an SVG into an HTML by means of the jQuery SVG plugin as follows:

<div id="map"></div>

<script type="text/javascript">
  $('#map').svg();
  var svg = $('#map').svg('get');
  svg.load('myimage.svg',{onLoad: function(){ alert('ready'); }});
</script>

This piece of code works well in Firefox and Chrome, but not in IE (version 8, no other version tested). The code generated by the plugin looks like this:

 <div id="map" class="hasSVG">
   <svg version="1.1" x="0.0px" y="0.0px" ... ></svg>
 </div>

So...how do I have to modify my code in order to support IE, too? My constraints: I need to load the SVG inline in order to access the SVG DOM right away in the onLoad callback.

Thanks.

Upvotes: 0

Views: 3371

Answers (2)

Micha
Micha

Reputation: 1

You can use the Adobe SVG Viewer as a viewer for IE. That should be not the problem.

On the developer site the examples are working fine over all version of IE 6 to 8 and FF. If I try also a small example of this plugin on my environment (e.g. via localhost (XAMPP) or direct access to the file) it works fine Firefox but not for IE.

Upvotes: 0

Erik Dahlstr&#246;m
Erik Dahlstr&#246;m

Reputation: 60966

Just to state the obvious: IE8 doesn't support svg, so even if you managed to load the SVG elements correctly they still wouldn't render without some sort of js shim or a plugin. Have you tried SVGWeb? Some help to get started over on svgboilerplate.com.

IE9 might be able to run the code though, you'll have to test and see.

Upvotes: 4

Related Questions