Skip to content

Instantly share code, notes, and snippets.

@webbingstudio
Created July 21, 2016 06:05
Show Gist options
  • Save webbingstudio/1b2429ce03ade3bb7be59c0638613001 to your computer and use it in GitHub Desktop.
Save webbingstudio/1b2429ce03ade3bb7be59c0638613001 to your computer and use it in GitHub Desktop.
modernizrでの判定もできないSnowLeopardのSafari5に対し、SVGsupport有無の判定を行う
(function($){
$(function(){
var userAgent = window.navigator.userAgent.toLowerCase();
if (userAgent.indexOf('safari') != -1) {
var version = userAgent.match(/^.*\sversion\/(\d+)\.\d.*$/);
if ( parseInt( version[1] ) < 9 ){
console.log('no SVG');
} else {
console.log('support SVG');
}
}
}); // end $(function
})(jQuery);
@webbingstudio
Copy link
Author

Safariのバージョンが2桁になった場合もいちおう対応してる

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment