Created
July 20, 2015 15:05
-
-
Save garystorey/aa59aaa3443dcb010189 to your computer and use it in GitHub Desktop.
Detect OS and Browser
This file contains hidden or 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
| var system = navigator.appVersion; | |
| if (navigator.appVersion.indexOf("Mac") != -1 ) { | |
| OS = "Mac"; | |
| } else if (navigator.appVersion.indexOf("PowerPC") != -1 ) { | |
| OS = "Mac"; | |
| } else if (navigator.appVersion.indexOf("Win") != -1 ) { | |
| OS = "Win"; | |
| } else if (navigator.appVersion.indexOf("SunOS") != -1 ) { | |
| OS = "Solaris"; | |
| } else { | |
| OS = "Linux"; | |
| //Determine Browser Version | |
| bName = navigator.appName; | |
| bVer = parseInt(navigator.appVersion); | |
| if (OS == "Mac" && bName=="Netscape") { | |
| } else if (OS =="Mac" && bName=="Microsoft Internet Explorer") { | |
| } else if (OS =="Win" || OS == "Linux" && bName == "Netscape") { | |
| } else if (OS =="Solaris" && bName=="Netscape") { | |
| } else if (OS =="Win" || OS == "Linux" && bName=="Microsoft Internet Explorer") { | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment