Skip to content

Instantly share code, notes, and snippets.

@ariya
Created March 30, 2012 04:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save ariya/2246447 to your computer and use it in GitHub Desktop.
Save ariya/2246447 to your computer and use it in GitHub Desktop.
// http://ie.microsoft.com/testdrive/Performance/BetaFishIE/Default.html
if (userAgent.indexOf('msie') > -1) {
index = userAgent.indexOf('msie');
this.browserCheck = "IE";
this.browserName = "Internet Explorer";
this.browserVersion = "" + parseFloat('' + userAgent.substring(index + 5));
this.browserTransform = "msTransform";
}
else if (userAgent.indexOf('chrome') > -1) {
index = userAgent.indexOf('chrome');
this.browserCheck = "Chrome";
this.browserName = "Google Chrome";
this.browserVersion = "" + parseFloat('' + userAgent.substring(index + 7));
this.browserTransform = "WebkitTransform";
}
else if (userAgent.indexOf('firefox') > -1) {
index = userAgent.indexOf('firefox');
this.browserCheck = "Firefox";
this.browserName = "Mozilla Firefox";
this.browserVersion = "" + parseFloat('' + userAgent.substring(index + 8));
this.browserTransform = "MozTransform";
}
else if (userAgent.indexOf('minefield') > -1) {
index = userAgent.indexOf('minefield');
this.browserCheck = "Firefox";
this.browserName = "Mozilla Firefox Minefield";
this.browserVersion = "" + parseFloat('' + userAgent.substring(index + 10));
this.browserTransform = "MozTransform";
}
else if (userAgent.indexOf('opera') > -1) {
this.browserCheck = "Opera";
this.browserName = "Opera";
this.browserVersion = "";
this.browserTransform = "OTransform";
}
else if (userAgent.indexOf('safari') > -1) {
index = userAgent.indexOf('safari');
this.browserCheck = "Safari";
this.browserName = "Apple Safari";
this.browserVersion = "" + parseFloat('' + userAgent.substring(index + 7));
this.browserTransform = "WebkitTransform";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment