Hi friends, In this post I am going to explain about how to get the browser name and there version using simple JavaScript function.

How to get browser name and version using JavaScript by Anil Kumar Panigrahi
JavaScript Code
1 2 3 4 5 6 7 8 9 10 11 | function detectBrowser(){ var N= navigator.appName; var UA= navigator.userAgent; var temp; var browserVersion= UA.match(/(opera|chrome|safari|firefox|msie)\/?\s*(\.?\d+(\.\d+)*)/i); if(browserVersion && (temp= UA.match(/version\/([\.\d]+)/i))!= null) browserVersion[2]= temp[1]; browserVersion= browserVersion? "Browser:"+[browserVersion[1]+"\n Version:"+ browserVersion[2]]: [N, navigator.appVersion,'-?']; alert(browserVersion); }; |
1 Comment
hackdeals.com · May 5, 2014 at 4:58 pm
Browser Name! I was searching since long.