navigator.doNotTrack

« Gecko 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.

Browser compatibility

  • Desktop
  • Mobile

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.doNotTrack is the value sent for the do-not-track header.

Tags (0)

Edit tags
  • No tags

Attachments (0)

 

Attach file