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
Browser compatibility
| Desktop | Mobile |
---|
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | Android webview | Chrome for Android | Firefox for Android | Opera for Android | Safari on iOS | Samsung Internet |
---|
doNotTrack | Chrome
Full support
23 | Edge
Full support
17-
Full support
17
- Notes Edge prior to version 17 implemented
window.doNotTrack .
| Firefox
Full support
9-
Full support
9
- Notes Prior to Firefox 32,
navigator.doNotTrack would report values of yes and no rather than 1 and 0 .
| IE
No support
9 — 11-
No support
9 — 11
- Prefixed Implemented with the vendor prefix: ms
- Notes For IE11 and subsequent versions, use
window.doNotTrack
| Opera
Full support
12 | Safari
No support
5.1 — 7-
No support
5.1 — 7
- Notes Safari 7.1.3+ uses
window.doNotTrack rather than navigator.doNotTrack .
| WebView Android
Full support
Yes | Chrome Android
Full support
Yes | Firefox Android
Full support
9-
Full support
9
- 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