SVG mouse events work in Firefox4 but not in IE8

前端 未结 2 580
走了就别回头了
走了就别回头了 2021-01-23 14:47

I have a standalone SVG file and a separate Javascript file to deal with mouse events triggered from the SVG file. The projects works well with Firefox but somehow I got problem

相关标签:
2条回答
  • 2021-01-23 15:16

    IE8 doesn't support SVG.

    There are Javascript tools available to help with that, but natively it doesn't support it.

    Of the tools I mentioned, my favourite is Raphael, but Raphael is a library for drawing the graphics; since you already have the SVG in your code, you may find a simple conversion library is more useful. Something like one of these perhaps: http://code.google.com/p/svg2vml/ or this: http://code.google.com/p/svgweb/

    Since you say that the SVG images are working in your page, I would say that you're probably already using one or other of these tools (possibly one of the ones I linked above, possibly another one -- there's quite a few of them). But my guess would be that the tool you're using doesn't include support for manipulating the SVG object with Javascript.

    You may therefore need to try another tool if you want this feature.

    0 讨论(0)
  • 2021-01-23 15:25

    As Spudley's answer says, IE8 doesn't support SVG.

    If the image is appearing on your page, thereare a few possibilities:

    • Something in your development stack may be converting it to a raster image (such as a PNG): right click the image and select "Properties", then see what value is reported for "Type".
    • You may have a browser plugin installed that renders SVGs (but does not provide the JavaScript interface). Try running IE8 in Safe Mode.

    Internet Explorer 9 does support SVG, however, so an IE upgrade, where possible, will solve that problem.

    0 讨论(0)
提交回复
热议问题