Created
May 19, 2013 15:55
-
-
Save stephanie-walter/5608071 to your computer and use it in GitHub Desktop.
Detecting SVG support
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function setCSS() { | |
var docBody = document.getElementsByTagName('body'); | |
docBody[0].className = 'svg'; | |
} | |
function SVGDetect() { | |
var testImg = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNzUiIGhlaWdodD0iMjc1Ij48L3N2Zz4%3D'; | |
var img = document.createElement('img'); | |
img.setAttribute('src', testImg); | |
img.onload = setCSS; | |
} | |
window.onload = SVGDetect; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment