Skip to content

Instantly share code, notes, and snippets.

@ekinertac
Created August 23, 2012 07:47
Show Gist options
  • Save ekinertac/3433933 to your computer and use it in GitHub Desktop.
Save ekinertac/3433933 to your computer and use it in GitHub Desktop.
Browser Detectio
navigator.browserName = (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