1

I am trying to develop a web application for mobile devices (Android and iPhone).
I came to know that Android older version browser doesn't support SVG.

Is there a way in JavaScript, jQuery (whatever, in fact) to check if browser supports SVG? So, if it doesn't support I might be able to do some "B" Code for my app to run properly for all browsers.

Phrogz
  • 296,393
  • 112
  • 651
  • 745
Salman Aslam
  • 761
  • 1
  • 11
  • 20
  • possible duplicate of [Which SVG support detection method is best?](http://stackoverflow.com/questions/9689310/which-svg-support-detection-method-is-best) – James Donnelly Jan 30 '15 at 15:38

2 Answers2

4

Simple, Modernizr, which supports mobile browsers too.

elclanrs
  • 92,861
  • 21
  • 134
  • 171
3

I would personally do something like this:

var supportsSVG = false;
try{
  var svg = document.createElementNS("http://www.w3.org/2000/svg",'svg');
  supportsSVG = typeof svg.createSVGPoint == 'function';
}catch(e){}

If it can create an SVG element, and that SVG element has a createSVGPoint function, then I'd bet that it supports SVG.

Or better yet, try to create and test some of the exact features you want. I have a list of SVG 1.1 objects/properties/methods on my site; find the object you try to create, find it, and see if it has the methods you need.

Phrogz
  • 296,393
  • 112
  • 651
  • 745