Home arrow JavaScript arrow JavaScript Examples Part I
JavaScript Examples Part I PDF
Monday, 26 November 2012

Example 1. Get info about visitor's browser and OS

To get info about a visitor operating system and browser name see the following code.

The html file for this example is:

example1.html
<html>
<head>
  <title>Display info</title>
  <script type="text/javascript" src="example1.js"></script>
</head>

<body>
  <h2 id="browserName"></h2>
  <h2 id="appName"></h2>
  <h2 id="platform"></h2>
</body>
</html>


And the JavaScript file:

example1.js
window.onload = displayVisitorInfo;

function displayVisitorInfo() {
    document.getElementById("browserName").innerHTML = navigator.userAgent;
    document.getElementById("appName").innerHTML = navigator.appName;
    document.getElementById("platform").innerHTML = navigator.platform;
}




Last Updated ( Monday, 26 November 2012 )
 
Next >

Other BSD Systems

OpenBSD

Misc

Solaris

Polls

Best BSD firewall?