CancelImage Upload

How to find out your visitor's JavaScript Browser Application

JavaScript may not be the most difficult programming language to learn, yet it is one of the most annoying due to different browsers having their own interpretations of various sets of code, and some do not even include functions which others do.

Clearly then for any JavaScript code to be successful across all types of browsers two elements are required. First, excessive testing. And second, the topic of this article, each type of browser needs to be recognised, so that alternative code, if required, can be provided. The code for this important piece of information is as follows:

navigator.appName

Here a more extensive HTML example that you can use to test the appName definition on various browsers:

<html>
<head>
<title>How to find out your visitor's browser type</title>
<script language="JavaScript">

function browserName()
{

      browserName = document.getElementById("browserName");

      browserName.innerHTML = navigator.appName;

}
</script>
</head>
<body onload="javascript:browserName();">
<span id="browserName"></span>
</body>
</html>

As you will no doubt notice, a lot of browsers use Netscape's JavaScript Application. Prime examples among these are Google Chrome and Safari. Internet Explorer of course has its own JavaScript Interpreter, while Opera also has developed it's own brand. Indeed, Opera at times can be the trickiest browser in regards to JavaScript programming. Many functions which are pretty standard in Netscape and IE appear to be lacking, or if present have not got wide spread documentation across the internet.

Note that if you want to find out the actual name of the browser, and not just the JavaScript Interpreter Name, read the following PHP tutorial.

Login
Want to leave a comment?

No problem. Just enter your email and password below.


register | home | reminder

myDesignTool Networking • www.mydesigntool.cominfo@mydesigntool.com