MathCurvesSurfacesWallpaper GroupsGallerySoftwarePOV-Ray
ProgramingLinuxPerl PythonHTMLCSSJavaScriptPHPJavaEmacsUnicode ♥
19dfoa3Q7oehm9MwCULQzBG8vqfCaeMazH
Web Hosting by 1&1

JavaScript: Detecting Browser; Browser Sniffing

Programer for Hire

Xah Lee, ,

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.

to see various info about your browser.

Here's the code.

// 2010-03-12
function ff() {
    var myInfo =
        "appName: " + navigator.appName + "\n" +
        "version: " + navigator.appVersion + "\n" +
        "Platform: " + navigator.platform + "\n" +
        "appCodeName: " + navigator.appCodeName + "\n" +
        "User agent: " + navigator.userAgent + "\n" +
        "Cookies enabled: " + navigator.cookieEnabled + "\n" +
        "Java enabled: " + navigator.javaEnabled() + "\n";
    alert(myInfo);
}

document.getElementById("id0f7ec").onclick = ff;

// Note: navigator.cookieEnabled returns a Boolean type.
// the value is auto converted to string when in string context.

// Note that javaEnabled() is a method, not property.
// it returns a Boolean type. It is also auto converted to string here
blog comments powered by Disqus