Reputation: 1643
I'm trying to find out how i can ask a browser if he supports JQuery SVG or not?
I have no idea with which browsers JQuery SVG is compatible with, because it isn't written/documentated anywhere.
But is there a way to ask the Browser if he supports svgs or JQuery SVG?
Like:
if (svg) drawSomething(); else loadAlternateImage();
I just want to draw 10 lines (but with complex algorithm).. so is jquery svg the best choice for this? I mean.. i use jquery a lot.
THX
Upvotes: 2
Views: 2533
Reputation: 6619
I think you could have a lot of help by using Modernizer. It helps you detect whatever the client support functions. What I can read they have support for detecting SVG support.
I created this mini-demo: http://jsbin.com/ucabiz/edit#source
You use it like this:
if(Modernizr.svg)
// Supported
}else{
// Unsupported
}
Upvotes: 11
Reputation: 3801
Try:
function supportsSvg() {
return document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#Shape", "1.0")
}
Upvotes: 5