While most of the JavaScript code that you use is supported across modern browsers, some of your JavaScript code will not work for some browsers, especially the older versions.

We can use the Navigator object to assist us with this problem. The Navigator object contains information about the visitor’s browser.

By knowing specific information about the user’s browser, we can serve the user’s session using the appropriate code and information. While there is no public standard that applies to the navigator object, all major browsers support it.

The Navigator object is created by JavaScript at runtime and not by manually initiating it in the JavaScript code.

The Navigator object has two methods that are available for you to use.

Example