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.
Syntax
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).
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. |
Candidate Recommendation | Initial definition |
Browser compatibility
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Update compatibility data on GitHub
| Desktop | Mobile | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Basic support | Chrome Full support 23 | Edge
No support
No
| Firefox
Full support
9
| IE
No support
9 — 11
| Opera Full support 12 | Safari
No support
5.1 — 7
| WebView Android Full support Yes | Chrome Android Full support Yes | Edge Mobile
No support
No
| Firefox Android
Full support
9
| Opera Android ? | Safari iOS ? | Samsung Internet Android ? |
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
Document Tags and Contributors
Tags:
Contributors to this page:
connorshea,
blq,
foxbunny,
Krinkle,
Sebastianz,
ChristianSiegert,
teoli,
scott.s.mccoy,
Standard8,
MHasan,
mitar,
kscarfone,
Sheppy,
ziyunfei,
vipsoft,
jlebar,
Marcoos,
jswisher
Last updated by:
connorshea,