How to Identify Browser Agent in JavaScript

Here is the Example code to identify the Browser Agent using Java script:

<script type=”text/javascript”>
var browserName=navigator.appName;
var userAgent = navigator.userAgent
if (browserName==”Microsoft Internet Explorer”){
alert(“Microsoft Internet Explorer”);
alert(“Microsoft Internet Explorer Version : “+navigator.appVersion);

else if (browserName==”Netscape” && userAgent.indexOf(“Chrome”) != -1 ){
alert(“Google Chrome”);
alert(“Google Chrome Version: “+navigator.appVersion);
else if(browserName==”Netscape” && userAgent.indexOf(“Mozilla”) != -1){
alert(“Mozilla Firefox”);
alert(“Mozilla Firefox Version : “+navigator.appVersion);
alert(“Another browser”);

Other Useful Links:

Top Java script Charting Frameworks

List of Java script MVC Frameworks

Enabling javascript in browsers

Creation of Dynamic rows in javascript

One thought on “How to Identify Browser Agent in JavaScript

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.