Table of contents
- 1. Summary
- 2. Syntax
- 3. Example
- 4. Specification
- 5. See also
- 6. Browser compatibility
Summary
Returns the user's do-not-track setting. This is "yes" if the user has requested not to be tracked by web sites, content, or advertising.
Syntax
dnt = navigator.doNotTrack;
Note that navigator.doNotTrack is not the value sent for the do-not-track header. When the do-not-track header sends "1", navigator.doNotTrack is "yes". When the header is unset, navigator.doNotTrack is "unspecified". When the header sends "0" (currently unsupported in Firefox), navigator.doNotTrack is "no".
Example
dump(window.navigator.doNotTrack); // prints "yes" if DNT is enabled; otherwise this is "unspecified" in Firefox
Specification
The Tracking Preference Expression (Working Draft) is based on an earlier version of this specification where navigator.doNotTrack is the value sent for the do-not-track header.
See also
Browser compatibility
| Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
|---|---|---|---|---|---|
| Basic support | ? | 9.0 (9.0) | 9 | 12 | 5.1 on OS X 10.7 |
| Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
|---|---|---|---|---|---|
| Basic support | ? | 9.0 (9.0) | ? | ? | ? |
- IE9 uses a vendor prefix, i.e., navigator.msDoNotTrack
- IE9, Opera 12, and Safari 5.1 are based on an earlier version of this specification where
navigator.doNotTrackis the value sent for the do-not-track header.


Mozilla Developer Network