Skip to content

Instantly share code, notes, and snippets.

@joshpangell
Created May 31, 2012 18:21
Show Gist options
  • Save joshpangell/2845221 to your computer and use it in GitHub Desktop.
Save joshpangell/2845221 to your computer and use it in GitHub Desktop.
Test browser for SVG/VML support
function supportsSvg() {
return document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#Shape", "1.0")
}
function supportsVml() {
if (typeof supportsVml.supported == "undefined") {
var a = document.body.appendChild(document.createElement('div'));
a.innerHTML = '<v:shape id="vml_flag1" adj="1" />';
var b = a.firstChild;
b.style.behavior = "url(#default#VML)";
supportsVml.supported = b ? typeof b.adj == "object": true;
a.parentNode.removeChild(a);
}
return supportsVml.supported
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment