Navigator: doNotTrack property

Deprecated: This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.

Non-standard: This feature is not standardized. We do not recommend using non-standard features in production, as they have limited browser support, and may change or be removed. However, they can be a suitable alternative in specific cases where no standard option exists.

The Navigator.doNotTrack property returns the user's Do Not Track setting, which indicates whether the user is requesting websites and advertisers to not track them.

The value of the property reflects that of the DNT HTTP header, i.e., values of "1", "0", or null.

The whole DNT (Do Not Track) specification has been discontinued. The mechanism design was flawed, because it was a cooperative feature between users, websites, and browsers. The idea is that the user tells the website to not track them, and the website would comply. However, there is no strict enforcement of this policy, so advertisement websites ignored the DNT header and tracked users anyway. The feature is therefore useless. Moreover, it is harmful as it leaves more user fingerprint in the header, which can be used to track users even more.

Browsers are exploring other more enforceable privacy features, such as global privacy control, restriction to third-party cookies, and more.

Value

A string or null.

Examples

js
console.log(navigator.doNotTrack);
// prints "1" if DNT is enabled; "0" if the user opted-in for tracking; otherwise null

Specifications

Part of the discontinued Tracking Preference Expression (DNT) specification.

Browser compatibility

desktop mobile server
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
Node.js
doNotTrack
Deprecated Non-standard
Chrome – Full support
Chrome 23 (Release date: 2012-11-06)
footnote Full support
Edge – Full support
Edge 17 (Release date: 2018-04-30)
footnote
footnote Before version 17, Edge implemented window.doNotTrack.
Firefox – Full support
Firefox 9 (Release date: 2011-12-20)
footnote
footnote In Firefox, navigator.doNotTrack returns "unspecified" instead of null.
footnote Before Firefox 32, navigator.doNotTrack would report values of "yes" and "no" rather than "1" and "0".
Opera – Full support
Opera 12 (Release date: 2012-06-14)
footnote Full support
Safari – No support
Safari 5.1 – 6 (Release date: 2011-07-20)
footnote Removed in 7 and later
Chrome Android – Full support
Chrome Android 25 (Release date: 2013-02-27)
footnote Full support
Firefox for Android – Full support
Firefox for Android 9 (Release date: 2011-12-21)
footnote
footnote In Firefox for Android, navigator.doNotTrack returns "unspecified" instead of null.
footnote Before Firefox for Android 32, navigator.doNotTrack would report values of "yes" and "no" rather than "1" and "0".
Opera Android – Full support
Opera Android 12 (Release date: 2012-02-25)
footnote Full support
Safari on iOS – No support
Safari on iOS 5 – 6 (Release date: 2011-10-12)
footnote Removed in 7 and later
Samsung Internet – Full support
Samsung Internet 1.5 (Release date: 2013-09-25)
footnote Full support
WebView Android – Full support
WebView Android 4.4 (Release date: 2013-12-09)
footnote Full support
WebView on iOS – No support
WebView on iOS 5 – 6 (Release date: 2011-10-12)
footnote Removed in 7 and later
Node.js – No support
Node.js
footnote No support

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support
Non-standard. Check cross-browser support before using.
Deprecated. Not for use in new websites.
See implementation notes.

See also

  • DNT HTTP header