How do I know if my browser supports SVG 2.0?

前端 未结 3 672
情歌与酒
情歌与酒 2021-02-07 01:19

How do I know if my browser supports SVG 2.0?

(Apart from trying a feature that is supposed to work in SVG2 and realizing it\'s not working or that it works ...?)

3条回答
  •  离开以前
    2021-02-07 02:17

    According to SVG 2.0 specification it may be something like

    document.implementation.hasFeature("http://www.w3.org/TR/SVG2/feature#GraphicsAttribute", 2.0)
    

    SVG 1.1 support you can check with hasFeature call

    document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#SVG", 1.1)
    

    EDIT: hasFeature is deprecated and removed from Web standards. It will return always true on modern browsers (DOM Spec).

提交回复
热议问题