This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
Returns the user's do-not-track setting. This is "1" if the user has requested not to be tracked by web sites, content, or advertising.
dnt = navigator.doNotTrack;
The value reflects that of the do-not-track header, i.e. values of {"1", "0", "unspecified" }. Note: Prior to Gecko 32, Gecko used the values { "yes", "no", "unspecified"} (bug 887703).
console.log(navigator.doNotTrack); // prints "1" if DNT is enabled; "0" if the user opted-in for tracking; otherwise this is "unspecified"
Specification | Status | Comment |
---|---|---|
Tracking Preference Expression (DNT) The definition of 'Navigator.doNotTrack' in that specification. | Candidate Recommendation | Initial definition |
Desktop | ||||||
---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
Basic support | 23 | No
|
9
|
9 — 11
|
12 | 5.1 — 7
|
Mobile | |||||||
---|---|---|---|---|---|---|---|
Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | iOS Safari | Samsung Internet | |
Basic support | Yes | Yes | No
|
9
|
? | ? | ? |
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/navigator/doNotTrack