asp.net.ph

Skip Navigation Links

appName Property

navigator Properties   Object Properties Summary


Retrieves the name of the browser.

Syntax


HTML N/A
Script [ sAppName = ] navigator.appName

Possible Values


Microsoft Internet Explorer String returned by Microsoft® Internet Explorer.
Netscape String returned by Netscape Navigator.
sAppName String specifying the browser's name.

The property is read-only with a default value specified by the browser.

Example

The following script detects the current user's browser and displays its appName and appVersion attributes in an alert box.

<script language="JavaScript">
<!--
function getBrowser ( ) {
   var browser = navigator.appName;
   browser += "\n" + navigator.appVersion;
   alert ( browser );
}
//-->
</script>

 Show me 

Often, this attribute is used with appName to check for a browser requirement in a script. In the following, a variable "isIE4" checks to see if the string returned by appName contains "Microsoft ..." and the appVersion is 4 or later; if not, the variable returns false. Other scripts can then refer to this variable as needed.

<script language="JavaScript">
var isIE4 = ( ( navigator.appName == 'Microsoft Internet Explorer' ) &&
   ( parseInt ( navigator.appVersion ) >= 4 ) );
...
if ( isIE4 )
  ... code for IE4
else
  ... code for others
</script>
Applies To

navigator

See Also

appCodeName, appMinorVersion, appVersion, userAgent



>

© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note