Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

JavaScript: How to use JavaScript to determine the type of browser?

DZone's Guide to

JavaScript: How to use JavaScript to determine the type of browser?

· Web Dev Zone
Free Resource

Get the senior executive’s handbook of important trends, tips, and strategies to compete and win in the digital economy.

In order to make Web Applications work in a variety of browsers and take advantage of their unique features, you must first determine the browser.  Depending on the browser, we need to adjust the code, especially the JavaScript code. Before doing this, can use JavaScript to determine the type of browser being used. Here is an example of two functions that determine if a user's browser is IE or Firefox:

function isIE() {
 var ie = (navigator.userAgent.indexOf("MSIE") != -1);
 
 return ie;
}

function isFireFox() {
 var fireFox = (navigator.userAgent.indexOf("Mozilla") != -1 ||
  navigator.userAgent.indexOf("FireFox") != -1);
 
 return fireFox;
}

Read this guide to learn everything you need to know about RPA, and how it can help you manage and automate your processes.

Topics:

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}