Navigator class

From PhiWiki
Jump to: navigation, search

The global Navigator class offers functions to query browser settings, ie. name, language, version etc.


The Navigator class is a global object in the client (browser) scripting environment.

var n=navigator;


  • String appCodeName [read]
  • String appName [read]
  • String appVersion [read]
  • Boolean cookieEnabled [read]
  • String language [read]
  • String plattform [read]
  • String userAgent [read]
  • Boolean javaEnabled [read]

String appCodeName

Returns the code name of the browser.

var codename=navigator.appCodeName;

String appName

Returns the official name of the browser.

var name=navigator.appName;

String appVersion

Returns the current version of the browser.

var version=navigator.appCodeName;

Note: this can contain a whole version string, not just a number.

Boolean cookiesEnabled

Returns true if the browser has cookies enabled otherwise false.

if ( navigator.cookiesEnabled ) { //yes we can set cookies }

String language

Returns the language of the browser. This is not necessarely the same language in which the current document is displayed. Phi returns always the system language.

var lang=navigator.language;

See also: phi.lang, window.document.lang.

String platform

Returns the operating system string the browser is running on.

var os=navigator.platform;

String userAgent

Returns the user agent string the browser is identifying itself to the server.

var agent=navigator.userAgent;

Boolean javaEnabled

Returns true if the browser has Java enabled. In Phi Java is always disabled and returns false.

if ( navigator.javaEnabled ) { //yes, Java is enabled }


The Navigator class has currently no functions defined.

Additional notes

Some browsers do not support all properties.