Window.navigator

  • Revision slug: DOM/window.navigator
  • Revision title: window.navigator
  • Revision id: 349629
  • Created:
  • Creator: Jeremie
  • Is current revision? No
  • Comment

Revision Content

{{DomRef}}

Summary

Returns a reference to the navigator object, which can be queried for information about the application running the script.

Example

alert("You're using " + navigator.appName);

Properties

{{domxref("window.navigator.appCodeName", "navigator.appCodeName")}} {{non-standard_inline}}
Returns the internal "code" name of the current browser. Do not rely on this property to return the correct value.
{{domxref("window.navigator.appName", "navigator.appName")}}
Returns the official name of the browser. Do not rely on this property to return the correct value.
{{domxref("window.navigator.appVersion", "navigator.appVersion")}}
Returns the version of the browser as a string. Do not rely on this property to return the correct value.
{{domxref("window.navigator.battery", "navigator.battery")}} {{gecko_minversion_inline("10.0")}}
Returns a {{domxref("window.navigator.battery", "battery")}} object you can use to get information about the battery charging status.
{{domxref("window.navigator.buildID", "navigator.buildID")}} {{non-standard_inline}}
Returns the build identifier of the browser (e.g. "2006090803")
{{domxref("window.navigator.connection", "navigator.connection")}}
Provides information about the network connection of a device.
{{domxref("window.navigator.cookieEnabled", "navigator.cookieEnabled")}}
Returns a boolean indicating whether cookies are enabled in the browser or not.
{{domxref("navigator.doNotTrack")}} {{non-standard_inline}}
Reports the value of the user's do-not-track preference. When this value is "yes", your web site or application should not track the user.
{{domxref("navigator.id")}} {{non-standard_inline}}
Returns the {{domxref("window.navigator.id", "id")}} object which you can use to add support for BrowserID to your web site.
{{domxref("window.navigator.language", "navigator.language")}}
Returns a string representing the language version of the browser.
{{domxref("window.navigator.mimeTypes", "navigator.mimeTypes")}}
Returns a list of the MIME types supported by the browser.
{{domxref("window.navigator.mozApps", "navigator.mozApps")}} {{non-standard_inline}}
Returns an {{domxref("window.navigator.mozApps", "Apps")}} object you can use to install, manage, and control Open Web apps.
{{domxref("window.navigator.mozCamera", "navigator.mozCamera")}} {{b2g_required_inline("1.0")}} {{non-standard_inline}}
Return a {{domxref("CameraManager")}} object you can use to access cameras available on your device.
{{domxref("navigator.mozNotification")}} {{MobileOnlyInline("2.0")}} {{non-standard_inline}}
{{domxref("navigator.webkitNotification")}}
Returns a {{domxref("navigator.mozNotification", "notification")}} object you can use to deliver notifications to the user from your web application.
{{domxref("window.navigator.mozSms", "navigator.mozSms")}} {{b2g_required_inline("1.0")}} {{gecko_minversion_inline("12.0")}} {{non-standard_inline}}
Returns a {{domxref("SmsManager")}} object you can use to manage SMS messaging in your web application.
{{domxref("navigator.mozSocial")}} {{non-standard_inline}}
{{todo("NeedsText")}}
{{domxref("window.navigator.mozTelephony", "navigator.mozTelephony")}} {{b2g_required_inline("1.0")}} {{non-standard_inline}}
Returns a {{domxref("Telephony")}} object you can use to create and manage telephone calls.
{{domxref("window.navigator.onLine", "navigator.onLine")}}
Returns a boolean indicating whether the browser is working online.
{{domxref("window.navigator.oscpu", "navigator.oscpu")}}
Returns a string that represents the current operating system.
{{domxref("window.navigator.platform", "navigator.platform")}}
Returns a string representing the platform of the browser.
{{domxref("window.navigator.plugins", "navigator.plugins")}}
Returns an array of the plugins installed in the browser.
{{domxref("window.navigator.product", "navigator.product")}} {{non-standard_inline}}
Returns the product name of the current browser. (e.g. "Gecko")
{{domxref("window.navigator.productSub", "navigator.productSub")}} {{non-standard_inline}}
Returns the build number of the current browser (e.g. "20060909")
{{domxref("window.navigator.securitypolicy", "navigator.securitypolicy")}} {{non-standard_inline}}
Returns an empty string. In Netscape 4.7x, returns "US & CA domestic policy" or "Export policy".
{{domxref("window.navigator.standalone", "navigator.standalone")}} {{non-standard_inline}}
Returns a boolean indicating whether the browser is running in standalone mode. Available on Apple's iOS Safari only.
{{domxref("window.navigator.userAgent", "navigator.userAgent")}}
Returns the user agent string for the current browser.
{{domxref("window.navigator.vendor", "navigator.vendor")}} {{non-standard_inline}}
Returns the vendor name of the current browser (e.g. "Netscape6")
{{domxref("window.navigator.vendorSub", "navigator.vendorSub")}} {{non-standard_inline}}
Returns the vendor version number (e.g. "6.1")
navigator.webkitPointer {{non-standard_inline}}
Returns a PointerLock object for the Mouse Lock API.

Methods

{{domxref("window.navigator.javaEnabled", "navigator.javaEnabled")}}
Indicates whether the host browser is Java-enabled or not.
{{domxref("window.navigator.mozIsLocallyAvailable", "navigator.mozIsLocallyAvailable")}} {{non-standard_inline}}
Lets code check to see if the document at a given URI is available without using the network.
{{domxref("window.navigator.preference", "navigator.preference")}} {{obsolete_inline("2.0")}} {{non-standard_inline}}
Sets a user preference. This method is only available to privileged code and is obsolete; you should use the XPCOM Preferences API instead.
{{domxref("window.navigator.registerContentHandler", "navigator.registerContentHandler")}}
Allows web sites to register themselves as a possible handler for a given MIME type.
{{domxref("navigator.registerProtocolHandler", "navigator.registerProtocolHandler")}}
Allows web sites to register themselves as a possible handler for a given protocol.
{{domxref("window.navigator.taintEnabled", "navigator.taintEnabled")}} {{deprecated_inline("1.7.8")}} {{obsolete_inline("9.0")}} {{non-standard_inline}}
Returns false. JavaScript taint/untaint functions removed in JavaScript 1.2.
{{domxref("window.navigator.vibrate", "navigator.vibrate()")}} {{gecko_minversion_inline("11.0")}}
Causes vibration on devices with support for it. Does nothing if vibration support isn't available.

Specification

See also

Revision Source

<div>
  {{DomRef}}</div>
<h2 id="Summary" name="Summary">Summary</h2>
<p>Returns a reference to the navigator object, which can be queried for information about the application running the script.</p>
<h2 id="Example" name="Example">Example</h2>
<div style="overflow:hidden">
  <pre class="brush:js">
alert("You're using " + navigator.appName);
</pre>
</div>
<h2 id="Properties" name="Properties">Properties</h2>
<dl>
  <dt>
    {{domxref("window.navigator.appCodeName", "navigator.appCodeName")}} {{non-standard_inline}}</dt>
  <dd>
    Returns the internal "code" name of the current browser. Do not rely on this property to return the correct value.</dd>
  <dt>
    {{domxref("window.navigator.appName", "navigator.appName")}}</dt>
  <dd>
    Returns the official name of the browser. Do not rely on this property to return the correct value.</dd>
  <dt>
    {{domxref("window.navigator.appVersion", "navigator.appVersion")}}</dt>
  <dd>
    Returns the version of the browser as a string. Do not rely on this property to return the correct value.</dd>
  <dt>
    {{domxref("window.navigator.battery", "navigator.battery")}} {{gecko_minversion_inline("10.0")}}</dt>
  <dd>
    Returns a {{domxref("window.navigator.battery", "battery")}} object you can use to get information about the battery charging status.</dd>
  <dt>
    {{domxref("window.navigator.buildID", "navigator.buildID")}} {{non-standard_inline}}</dt>
  <dd>
    Returns the build identifier of the browser (e.g. "2006090803")</dd>
  <dt>
    {{domxref("window.navigator.connection", "navigator.connection")}}</dt>
  <dd>
    Provides information about the network connection of a device.</dd>
  <dt>
    {{domxref("window.navigator.cookieEnabled", "navigator.cookieEnabled")}}</dt>
  <dd>
    Returns a boolean indicating whether cookies are enabled in the browser or not.</dd>
  <dt>
    {{domxref("navigator.doNotTrack")}} {{non-standard_inline}}</dt>
  <dd>
    Reports the value of the user's do-not-track preference. When this value is "yes", your web site or application should not track the user.</dd>
  <dt>
    {{domxref("navigator.id")}} {{non-standard_inline}}</dt>
  <dd>
    Returns the {{domxref("window.navigator.id", "id")}} object which you can use to add support for <a href="/en-US/docs/BrowserID" title="BrowserID">BrowserID</a> to your web site.</dd>
  <dt>
    {{domxref("window.navigator.language", "navigator.language")}}</dt>
  <dd>
    Returns a string representing the language version of the browser.</dd>
  <dt>
    {{domxref("window.navigator.mimeTypes", "navigator.mimeTypes")}}</dt>
  <dd>
    Returns a list of the MIME types supported by the browser.</dd>
  <dt>
    {{domxref("window.navigator.mozApps", "navigator.mozApps")}} {{non-standard_inline}}</dt>
  <dd>
    Returns an {{domxref("window.navigator.mozApps", "Apps")}} object you can use to install, manage, and control <a href="/Open_Web_Apps" title="Open Web apps">Open Web apps</a>.</dd>
  <dt>
    {{domxref("window.navigator.mozCamera", "navigator.mozCamera")}} {{b2g_required_inline("1.0")}} {{non-standard_inline}}</dt>
  <dd>
    Return a {{domxref("CameraManager")}} object you can use to access cameras available on your device.</dd>
  <dt>
    {{domxref("navigator.mozNotification")}} {{MobileOnlyInline("2.0")}} {{non-standard_inline}}<br />
    {{domxref("navigator.webkitNotification")}}</dt>
  <dd>
    Returns a {{domxref("navigator.mozNotification", "notification")}} object you can use to deliver notifications to the user from your web application.</dd>
  <dt>
    {{domxref("window.navigator.mozSms", "navigator.mozSms")}} {{b2g_required_inline("1.0")}} {{gecko_minversion_inline("12.0")}} {{non-standard_inline}}</dt>
  <dd>
    Returns a {{domxref("SmsManager")}} object you can use to manage SMS messaging in your web application.</dd>
  <dt>
    {{domxref("navigator.mozSocial")}} {{non-standard_inline}}</dt>
  <dd>
    {{todo("NeedsText")}}</dd>
  <dt>
    {{domxref("window.navigator.mozTelephony", "navigator.mozTelephony")}} {{b2g_required_inline("1.0")}} {{non-standard_inline}}</dt>
  <dd>
    Returns a {{domxref("Telephony")}} object you can use to create and manage telephone calls.</dd>
  <dt>
    {{domxref("window.navigator.onLine", "navigator.onLine")}}</dt>
  <dd>
    Returns a boolean indicating whether the browser is working online.</dd>
  <dt>
    {{domxref("window.navigator.oscpu", "navigator.oscpu")}}</dt>
  <dd>
    Returns a string that represents the current operating system.</dd>
  <dt>
    {{domxref("window.navigator.platform", "navigator.platform")}}</dt>
  <dd>
    Returns a string representing the platform of the browser.</dd>
  <dt>
    {{domxref("window.navigator.plugins", "navigator.plugins")}}</dt>
  <dd>
    Returns an array of the plugins installed in the browser.</dd>
  <dt>
    {{domxref("window.navigator.product", "navigator.product")}} {{non-standard_inline}}</dt>
  <dd>
    Returns the product name of the current browser. (e.g. "Gecko")</dd>
  <dt>
    {{domxref("window.navigator.productSub", "navigator.productSub")}} {{non-standard_inline}}</dt>
  <dd>
    Returns the build number of the current browser (e.g. "20060909")</dd>
  <dt>
    {{domxref("window.navigator.securitypolicy", "navigator.securitypolicy")}} {{non-standard_inline}}</dt>
  <dd>
    Returns an empty string. In Netscape 4.7x, returns "US &amp; CA domestic policy" or "Export policy".</dd>
  <dt>
    {{domxref("window.navigator.standalone", "navigator.standalone")}} {{non-standard_inline}}</dt>
  <dd>
    Returns a boolean indicating whether the browser is running in standalone mode. Available on Apple's iOS Safari only.</dd>
  <dt>
    {{domxref("window.navigator.userAgent", "navigator.userAgent")}}</dt>
  <dd>
    Returns the user agent string for the current browser.</dd>
  <dt>
    {{domxref("window.navigator.vendor", "navigator.vendor")}} {{non-standard_inline}}</dt>
  <dd>
    Returns the vendor name of the current browser (e.g. "Netscape6")</dd>
  <dt>
    {{domxref("window.navigator.vendorSub", "navigator.vendorSub")}} {{non-standard_inline}}</dt>
  <dd>
    Returns the vendor version number (e.g. "6.1")</dd>
  <dt>
    <a href="/en-US/docs/API/Pointer_Lock_API" title="Mouse Lock API"><code>navigator.webkitPointer</code></a> {{non-standard_inline}}</dt>
  <dd>
    Returns a PointerLock object for the <a href="/en-US/docs/API/Pointer_Lock_API" title="Mouse Lock API">Mouse Lock API</a>.</dd>
</dl>
<h2 id="Methods" name="Methods">Methods</h2>
<dl>
  <dt>
    {{domxref("window.navigator.javaEnabled", "navigator.javaEnabled")}}</dt>
  <dd>
    Indicates whether the host browser is Java-enabled or not.</dd>
  <dt>
    {{domxref("window.navigator.mozIsLocallyAvailable", "navigator.mozIsLocallyAvailable")}} {{non-standard_inline}}</dt>
  <dd>
    Lets code check to see if the document at a given URI is available without using the network.</dd>
  <dt>
    {{domxref("window.navigator.preference", "navigator.preference")}} {{obsolete_inline("2.0")}} {{non-standard_inline}}</dt>
  <dd>
    Sets a user preference. This method is <a class="external" href="http://www.faqts.com/knowledge_base/view.phtml/aid/1608/fid/125/lang/en">only available to privileged code</a> and is obsolete; you should use the XPCOM <a href="/en-US/docs/Preferences_API" title="Preferences_API">Preferences API</a> instead.</dd>
  <dt>
    {{domxref("window.navigator.registerContentHandler", "navigator.registerContentHandler")}}</dt>
  <dd>
    Allows web sites to register themselves as a possible handler for a given MIME type.</dd>
  <dt>
    {{domxref("navigator.registerProtocolHandler", "navigator.registerProtocolHandler")}}</dt>
  <dd>
    Allows web sites to register themselves as a possible handler for a given protocol.</dd>
  <dt>
    {{domxref("window.navigator.taintEnabled", "navigator.taintEnabled")}} {{deprecated_inline("1.7.8")}} {{obsolete_inline("9.0")}} {{non-standard_inline}}</dt>
  <dd>
    Returns <code>false</code>. JavaScript taint/untaint functions removed in JavaScript 1.2.</dd>
  <dt>
    {{domxref("window.navigator.vibrate", "navigator.vibrate()")}} {{gecko_minversion_inline("11.0")}}</dt>
  <dd>
    Causes vibration on devices with support for it. Does nothing if vibration support isn't available.</dd>
</dl>
<h2 id="Specification" name="Specification">Specification</h2>
<ul>
  <li>Defined in <a class="external" href="http://www.whatwg.org/html/#navigator" title="http://www.whatwg.org/html/#navigator">HTML</a>.</li>
</ul>
<h2 id="See_also" name="See_also">See also</h2>
<ul>
  <li><a href="/en-US/docs/DOM_Client_Object_Cross-Reference/navigator" title="DOM_Client_Object_Cross-Reference/navigator">DOM Client Object Cross-Reference:navigator</a></li>
</ul>
Revert to this revision