JavaScript: Browser Info, Navigator Object

By Xah Lee. Date: . Last updated: .

This pages shows you how to use JavaScript to find various info about browser. For example, whether cookies is on, java is installed, or about browser version.

Most info about browsers are in the browser object navigator. Here's the navigator object's properties supported by all browsers, and what your browser shows, orderly roughly in practical usefulness:

Here's the code.

<div id="showinfo55223"></div>
function showBrowserInfo() {

    var newNode = document.createElement("ul");

        "<b>appName:</b> " + navigator.appName,
        "<b>appCodeName:</b> " + navigator.appCodeName,
        "<b>appVersion:</b> " + navigator.appVersion,
        "<b>Platform:</b> " + navigator.platform,
        "<b>product:</b> " + navigator.product,
        "<b>userAgent:</b> " + navigator.userAgent,
        "<b>cookieEnabled:</b> " + navigator.cookieEnabled,
        "<b>javaEnabled:</b> " + navigator.javaEnabled(),
        // "<b>mimeTypes:</b> " + JSON.stringify(navigator.mimeTypes),
        // "<b>plugins:</b> " + JSON.stringify(navigator.plugins),
        function (x) {
                (function (ele,inner) {
                    ele.innerHTML = inner;
                    return ele;
                })(document.createElement("li"), x)

    // insert the new node into document
    var anchor = document.getElementById("showinfo55223");



navigator.cookieEnabled returns a Boolean type. The value is auto converted to string when in string context.

javaEnabled() is a method, not property. It returns a Boolean type. It is also auto converted to string here.


Like what you read? Buy JavaScript in Depth
or, buy something from my keyboard store