Is a simple JavaScript module that determines whether or not the given browser supports SVG.
npm install if-svg --save-dev
var isSVG = require('is-svg');
if(isSVG()){
// do something
}
// ifSVG | |
// | |
// Use: Determines whether or not the given browser supports SVG | |
// | |
// Returns: Boolean | |
// ------------------------------------------------------------ | |
module.exports = function ifSVG(){ | |
if (!document.implementation.hasFeature('http://www.w3.org/TR/SVG11/feature#Image', '1.1')) { | |
return false; | |
}else{ | |
return true; | |
} | |
} |
{ | |
"name": "if-svg", | |
"version": "1.0.3", | |
"description": "Determines whether or not the given browser supports SVG.", | |
"main": "if-svg.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"homepage": "https://gist.github.com/ryanburgess/9835ab8b42002df63846", | |
"repository": { | |
"type": "git", | |
"url": "https://gist.github.com/9835ab8b42002df63846.git" | |
}, | |
"keywords": [ | |
"svg", | |
"javascript", | |
"browser", | |
"detect", | |
"check", | |
"images" | |
], | |
"author": "Ryan Burgess <rburgess@evernote.com> (http://everernote.com/)", | |
"license": "MIT" | |
} |