开发者

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.


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜