Created
May 20, 2011 10:14
-
-
Save neave/982676 to your computer and use it in GitHub Desktop.
System.js with UAs reordered and iOS updated to include iPhone
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
/** | |
* @author mr.doob / http://mrdoob.com/ | |
*/ | |
System = { | |
browser: ( function () { | |
if ( navigator.userAgent.match( /msie/i ) ) { | |
return 'Internet Explorer'; | |
} else if ( navigator.userAgent.match( /chrome/i ) ) { | |
return 'Chrome'; | |
} else if ( navigator.userAgent.match( /firefox/i ) ) { | |
return 'Firefox'; | |
} else if ( navigator.userAgent.match( /mobile safari/i ) ) { | |
return 'Mobile Safari'; | |
} else if ( navigator.userAgent.match( /safari/i ) ) { | |
return 'Safari'; | |
} else if ( navigator.userAgent.match( /opera/i ) ) { | |
return 'Opera'; | |
} else if ( navigator.userAgent.match( /arora/i ) ) { | |
return 'Arora'; | |
} else if ( navigator.userAgent.match( /epiphany/i ) ) { | |
return 'Epiphany'; | |
} else if ( navigator.userAgent.match( /midori/i ) ) { | |
return 'Midori'; | |
} | |
return false; | |
} )(), | |
os: ( function () { | |
if ( navigator.userAgent.match( /windows/i ) ) { | |
return 'Windows'; | |
} else if ( navigator.userAgent.match( /macintosh/i ) ) { | |
return 'Macintosh'; | |
} else if ( navigator.userAgent.match( /linux/i ) ) { | |
return 'Linux'; | |
} else if ( navigator.userAgent.match( /android/i ) ) { | |
return 'Android'; | |
} else if ( navigator.userAgent.match( /iphone|ipod|ipad/i ) ) { | |
return 'iOS'; | |
} | |
return false; | |
} )(), | |
supports: { | |
canvas: !! window.CanvasRenderingContext2D, | |
webgl: ( function () { | |
try { | |
return !! window.WebGLRenderingContext && !! document.createElement( 'canvas' ).getContext( 'experimental-webgl' ); | |
} catch( error ) { | |
return false; | |
} | |
} )(), | |
worker: !! window.Worker, | |
file: window.File && window.FileReader && window.FileList && window.Blob | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment