Navigator.doNotTrack

« DOM Reference

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, Safari 5.1, and Chrome 31 are based on an earlier version of this specification where navigator.doNotTrack is the value sent for the do-not-track header.

 

Document Tags and Contributors

Contributors to this page: Sheppy, Marcoos, ziyunfei, jlebar, jswisher, mitar, kscarfone, teoli, vipsoft
Last updated by: mitar,