Skip to content

Instantly share code, notes, and snippets.

@jperona
Created November 15, 2012 00:37
Show Gist options
  • Save jperona/4075862 to your computer and use it in GitHub Desktop.
Save jperona/4075862 to your computer and use it in GitHub Desktop.
Browser Detection
navigator.sayswho= (function(){
var N= navigator.appName, ua= navigator.userAgent, tem;
var M= ua.match(/(opera|chrome|safari|firefox|msie)\/?\s*(\.?\d+(\.\d+)*)/i);
if(M && (tem= ua.match(/version\/([\.\d]+)/i))!= null) M[2]= tem[1];
M= M? [M[1], M[2]]: [N, navigator.appVersion, '-?'];
return M;
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment