mozilla
Your Search Results

    Navigator.doNotTrack

    This is an experimental technology
    Because this technology's specification has not stabilized, check the compatibility table for the proper prefixes to use in various browsers. Also note that the syntax and behavior of an experimental technology is subject to change in future versions of browsers as the spec changes.

    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;
    

    The value reflects that of the do-not-track header, i.e. values of {"1", "0", "unspecified" }. Note: Prior to Gecko 32, Gecko used the values { "yes", "no", "unspecified"} (bug 887703).

    Example

    dump(window.navigator.doNotTrack); 
    // prints "1" if DNT is enabled; "0" if the user opted-in for tracking; otherwise this is "unspecified"
    

    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 23 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
    • Prior to Gecko 32, Firefox would report navigator.doNotTrack with values of "yes" and "no" rather than "1" and "0"
    • Safari 7.1.3 appears to use window.doNotTrack rather than navigator.doNotTrack

     

    Document Tags and Contributors

    Last updated by: teoli,
    Hide Sidebar