Navigator

The navigator object lets JavaScript know what type of web browser your visitor is using.

Properties

appName

FF, IE 3

Manufacturer of the browser (Netscape, Internet Explorer, Opera, and so on)

Example:

if (navigator.appName == "Netscape")
{
    window.location = "netscape_index.html";
}

This code sends a visitor to a page called netscape_index.html if the visitor is using Netscape.

appVersion

FF, IE 3

String representing the version of the browser. It's not useful unless interpreted with the parseFloat() function.

Example:

if (parseFloat(navigator.appVersion) < 2)
{
    alert("Isn't it time to upgrade?");
}

Less Common Properties

appCodeName

FF, IE 3

Read-only: Browser's code name

browserLanguage

IE 4

Read-only: Language in which the browser's interface is dis-played, ...

Get The Book of JavaScript, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.