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

前端 未结 8 1413
春和景丽
春和景丽 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:50

    var svgSupport = (window.SVGSVGElement) ? true : false;
    

    Works, if you assume that non-SVG browsers are IE5.5 or better and can support VML. Tested on IE6, Firefox 8, Chrome 14.0.

    Raphael is very cool, but it does not support the concept of groups, which can be limiting depending on what you are doing. Dmitry will probably flame me for saying so, though.

提交回复
热议问题