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.
dnt = navigator.doNotTrack;
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".
dump(window.navigator.doNotTrack); // prints "yes" if DNT is enabled; otherwise this is "unspecified" in Firefox
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.
|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, Safari 5.1, and Chrome 31 are based on an earlier version of this specification where
navigator.doNotTrackis the value sent for the do-not-track header.