1. 8.9 System state and capabilities
      1. 8.9.1 The Navigator object
        1. 8.9.1.1 Client identification
        2. 8.9.1.2 Language preferences
        3. 8.9.1.3 Custom scheme handlers: the registerProtocolHandler() method
        4. 8.9.1.4 Cookies
        5. 8.9.1.5 Plugins

8.9 System state and capabilities

8.9.1 The Navigator object

Navigator

Support in all current engines.

Firefox1+Safari1+Chrome1+
Opera3+Edge79+
Edge (Legacy)12+Internet Explorer4+
Firefox Android4+Safari iOS1+Chrome Android18+WebView Android1+Samsung Internet1.0+Opera Android10.1+
8.9.1.1 Client identification

In certain cases, despite the best efforts of the entire industry, web browsers have bugs and limitations that web authors are forced to work around.

This section defines a collection of attributes that can be used to determine, from script, the kind of user agent in use, in order to work around these issues.

Client detection should always be limited to detecting known current versions; future versions and unknown versions should always be assumed to be fully compliant.

self . navigator . appCodeName

NavigatorID/appCodeName

Support in all current engines.

FirefoxYesSafariYesChromeYes
OperaYesEdgeYes
Edge (Legacy)12+Internet ExplorerYes
Firefox AndroidYesSafari iOSYesChrome AndroidYesWebView AndroidYesSamsung InternetYesOpera AndroidYes

Returns the string "Mozilla".

self . navigator . appName

NavigatorID/appName

Support in all current engines.

FirefoxYesSafariYesChromeYes
OperaYesEdgeYes
Edge (Legacy)12+Internet ExplorerYes
Firefox AndroidYesSafari iOSYesChrome AndroidYesWebView AndroidYesSamsung InternetYesOpera AndroidYes

Returns the string "Netscape".

self . navigator . appVersion

NavigatorID/appVersion

Support in all current engines.

FirefoxYesSafariYesChromeYes
OperaYesEdgeYes
Edge (Legacy)12+Internet ExplorerYes
Firefox AndroidYesSafari iOSYesChrome AndroidYesWebView AndroidYesSamsung InternetYesOpera AndroidYes

Returns the version of the browser.

self . navigator . platform

NavigatorID/platform

Support in all current engines.

FirefoxYesSafariYesChromeYes
OperaYesEdgeYes
Edge (Legacy)12+Internet ExplorerYes
Firefox AndroidYesSafari iOSYesChrome AndroidYesWebView AndroidYesSamsung InternetYesOpera AndroidYes

Returns the name of the platform.

self . navigator . product

NavigatorID/product

Support in all current engines.

FirefoxYesSafariYesChromeYes
OperaYesEdgeYes
Edge (Legacy)12+Internet ExplorerYes
Firefox AndroidYesSafari iOSYesChrome AndroidYesWebView AndroidYesSamsung InternetYesOpera AndroidYes

Returns the string "Gecko".

window . navigator . productSub

Navigator/productSub

Support in all current engines.

FirefoxYesSafariYesChromeYes
OperaYesEdgeYes
Edge (Legacy)12+Internet ExplorerYes
Firefox AndroidYesSafari iOSYesChrome AndroidYesWebView AndroidYesSamsung InternetYesOpera AndroidYes

Returns either the string "20030107", or the string "20100101".

self . navigator . userAgent

NavigatorID/userAgent

Support in all current engines.

FirefoxYesSafariYesChromeYes
OperaYesEdgeYes
Edge (Legacy)12+Internet ExplorerYes
Firefox AndroidYesSafari iOSYesChrome AndroidYesWebView AndroidYesSamsung InternetYesOpera AndroidYes

Returns the complete `User-Agent` header.

window . navigator . vendor

Navigator/vendor

Support in all current engines.

FirefoxYesSafariYesChrome1+
OperaYesEdge79+
Edge (Legacy)12+Internet ExplorerYes
Firefox AndroidYesSafari iOSYesChrome AndroidYesWebView AndroidYesSamsung InternetYesOpera AndroidYes

Returns either the empty string, the string "Apple Computer, Inc.", or the string "Google Inc.".

window . navigator . vendorSub

Navigator/vendorSub

Support in all current engines.

FirefoxYesSafariYesChromeYes
Opera15+EdgeYes
Edge (Legacy)12+Internet ExplorerYes
Firefox AndroidYesSafari iOSYesChrome AndroidYesWebView AndroidYesSamsung InternetYesOpera Android14+

Returns the empty string.

8.9.1.2 Language preferences
self . navigator . language

NavigatorLanguage/language

Support in all current engines.

Firefox1+Safari1+Chrome1+
Opera4+Edge79+
Edge (Legacy)12+Internet Explorer11
Firefox Android4+Safari iOS1+Chrome Android18+WebView Android1+Samsung Internet1.0+Opera Android10.1+

Returns a language tag representing the user's preferred language.

self . navigator . languages

NavigatorLanguage/languages

Support in all current engines.

Firefox32+Safari11+Chrome32+
Opera24+Edge79+
Edge (Legacy)12+Internet Explorer11
Firefox Android4+Safari iOSYesChrome Android32+WebView Android4.4.3+Samsung Internet2.0+Opera Android24+

Returns an array of language tags representing the user's preferred languages, with the most preferred language first.

The most preferred language is the one returned by navigator.language.

A languagechange event is fired at the Window or WorkerGlobalScope object when the user agent's understanding of what the user's preferred languages are changes.

8.9.1.3 Custom scheme handlers: the registerProtocolHandler() method

Navigator/registerProtocolHandler

Firefox3+Safari?Chrome13+
Opera11.6+Edge79+
Edge (Legacy)NoInternet Explorer?
Firefox AndroidNoSafari iOSNoChrome AndroidNoWebView AndroidNoSamsung InternetYesOpera Android?
caniuse.com table
window . navigator . registerProtocolHandler(scheme, url)

Registers a handler for scheme at url. For example, an online telephone messaging service could register itself as a handler of the sms: scheme, so that if the user clicks on such a link, they are given the opportunity to use that web site. [SMS]

The string "%s" in url is used as a placeholder for where to put the URL of the content to be handled.

Throws a "SecurityError" DOMException if the user agent blocks the registration (this might happen if trying to register as a handler for "http", for instance).

Throws a "SyntaxError" DOMException if the "%s" string is missing in url.

window . navigator . unregisterProtocolHandler(scheme, url)

Unregisters the handler given by the arguments.

Throws a "SecurityError" DOMException if the user agent blocks the deregistration (this might happen if with invalid schemes, for instance).

Throws a "SyntaxError" DOMException if the "%s" string is missing in url.

8.9.1.4 Cookies
window . navigator . cookieEnabled

Navigator/cookieEnabled

Support in all current engines.

Firefox1+Safari1+Chrome1+
OperaYesEdge79+
Edge (Legacy)12+Internet ExplorerYes
Firefox Android4+Safari iOS1+Chrome Android18+WebView Android1+Samsung Internet7.0+Opera AndroidYes

Returns false if setting a cookie will be ignored, and true otherwise.

8.9.1.5 Plugins
window . navigator . plugins . refresh( [ refresh ] )

NavigatorPlugins/plugins

Support in one engine only.

Firefox?Safari?ChromeYes
Opera?EdgeYes
Edge (Legacy)NoInternet Explorer?
Firefox Android?Safari iOS?Chrome AndroidYesWebView AndroidYesSamsung InternetYesOpera Android?

Updates the lists of supported plugins and MIME types for this page, and reloads the page if the lists have changed.

window . navigator . plugins . length

Returns the number of plugins, represented by Plugin objects, that the user agent reports.

plugin = window . navigator . plugins . item(index)
window . navigator . plugins[index]

Returns the specified Plugin object.

plugin = window . navigator . plugins . item(name)
window . navigator . plugins[name]

Returns the Plugin object for the plugin with the given name.

window . navigator . mimeTypes . length

NavigatorPlugins/mimeTypes

Support in one engine only.

Firefox?Safari?ChromeYes
Opera?EdgeYes
Edge (Legacy)NoInternet Explorer?
Firefox Android?Safari iOS?Chrome AndroidYesWebView AndroidYesSamsung InternetYesOpera Android?

Returns the number of MIME types, represented by MimeType objects, supported by the plugins that the user agent reports.

mimeType = window . navigator . mimeTypes . item(index)
window . navigator . mimeTypes[index]

Returns the specified MimeType object.

mimeType = window . navigator . mimeTypes . item(name)
window . navigator . mimeTypes[name]

Returns the MimeType object for the given MIME type.

plugin . name

Returns the plugin's name.

plugin . description

Returns the plugin's description.

plugin . filename

Returns the plugin library's filename, if applicable on the current platform.

plugin . length

Returns the number of MIME types, represented by MimeType objects, supported by the plugin.

mimeType = plugin . item(index)
plugin[index]

Returns the specified MimeType object.

mimeType = plugin . item(name)
plugin[name]

Returns the MimeType object for the given MIME type.

mimeType . type

Returns the MIME type.

mimeType . description

Returns the MIME type's description.

mimeType . suffixes

Returns the MIME type's typical file extensions, in a comma-separated list.

mimeType . enabledPlugin

Returns the Plugin object that implements this MIME type.

window . navigator . javaEnabled()

NavigatorPlugins/javaEnabled

Support in one engine only.

Firefox?Safari?ChromeYes
Opera?EdgeYes
Edge (Legacy)NoInternet Explorer?
Firefox Android?Safari iOS?Chrome AndroidYesWebView AndroidYesSamsung InternetYesOpera Android?

Returns true if there's a plugin that supports the MIME type "application/x-java-vm".