How do you detect support for VML or SVG in a browser

前端 未结 8 1378
春和景丽
春和景丽 2020-11-29 18:12

I\'m writing a bit of javascript and need to choose between SVG or VML (or both, or something else, it\'s a weird world). Whilst I know that for now that only IE supports VM

8条回答
  •  北海茫月
    2020-11-29 18:37

    You might like to skip this and use a JS library which will allow you to do vector drawing cross-browser, if that's the intention. The library will then handle this, outputting to SVG if supported or fallback to canvas, VML, flash, silverlight, etc if not, depending on what's available.

    Examples of libraries that will do this are, in no particular order:

    • dojo.gfx (http://docs.dojocampus.org/dojox/gfx/)
    • Raphaël (http://raphaeljs.com/)
    • SVGWeb (http://code.google.com/p/svgweb/)

提交回复
热议问题