Navigator.doNotTrack

The Navigator.doNotTrack property returns the user's Do Not Track setting, which indicates whether the user is requesting web sites and advertisers to not track them.

The value of the property reflects that of the DNT HTTP header, i.e. values of "1", "0", or "unspecified".

Example

console.log(navigator.doNotTrack);
// prints "1" if DNT is enabled; "0" if the user opted-in for tracking; otherwise this is "unspecified"

Specifications

Specification Status Comment
Tracking Preference Expression (DNT)
The definition of 'Navigator.doNotTrack' in that specification.
Obsolete Initial definition

Browser compatibility

DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
doNotTrack
Experimental
Chrome Full support 23Edge Full support 17
Notes
Full support 17
Notes
Notes Edge prior to version 17 implemented window.doNotTrack.
Firefox Full support 9
Notes
Full support 9
Notes
Notes Prior to Firefox 32, navigator.doNotTrack would report values of yes and no rather than 1 and 0.
IE No support 9 — 11
Prefixed Notes
No support 9 — 11
Prefixed Notes
Prefixed Implemented with the vendor prefix: ms
Notes For IE11 and subsequent versions, use window.doNotTrack
Opera Full support 12Safari No support 5.1 — 7
Notes
No support 5.1 — 7
Notes
Notes Safari 7.1.3+ uses window.doNotTrack rather than navigator.doNotTrack.
WebView Android Full support YesChrome Android Full support YesFirefox Android Full support 9
Notes
Full support 9
Notes
Notes Prior to Firefox 32, navigator.doNotTrack would report values of yes and no rather than 1 and 0.
Opera Android ? Safari iOS ? Samsung Internet Android Full support Yes

Legend

Full support
Full support
No support
No support
Compatibility unknown
Compatibility unknown
Experimental. Expect behavior to change in the future.
Experimental. Expect behavior to change in the future.
See implementation notes.
See implementation notes.
Requires a vendor prefix or different name for use.
Requires a vendor prefix or different name for use.

See also