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

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

范例

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

规范

规范 状态 注释
Tracking Preference Expression (DNT)
The definition of 'Navigator.doNotTrack' in that specification.
过时 初始定义

浏览器兼容性

The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. 更新 GitHub 上的兼容性数据
桌面 移动
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
doNotTrack Chrome 23 Edge 17
17
Edge prior to version 17 implemented window.doNotTrack .
Firefox 9
9
Prior to Firefox 32, navigator.doNotTrack would report values of yes and no 而不是 1 and 0 .
IE 9 — 11 Prefixed
不支持 9 — 11 Prefixed
Prefixed Implemented with the vendor prefix: ms
For IE11 and subsequent versions, use window.doNotTrack
Opera 12 Safari 5.1 — 7
不支持 5.1 — 7
Safari 7.1.3+ uses window.doNotTrack 而不是 navigator.doNotTrack .
WebView Android Yes Chrome Android Yes Firefox Android 9
9
Prior to Firefox 32, navigator.doNotTrack would report values of yes and no 而不是 1 and 0 .
Opera Android ? Safari iOS ? Samsung Internet Android Yes

图例

完整支持

完整支持

不支持

不支持

兼容性未知 ?

兼容性未知

实验。期望将来行为有所改变。

实验。期望将来行为有所改变。

见实现注意事项。

要求使用供应商前缀或不同名称。

要求使用供应商前缀或不同名称。

另请参阅

元数据

  • 最后修改:
  1. Navigator
  2. 特性
    1. activeVRDisplays
    2. appCodeName
    3. appName
    4. appVersion
    5. battery
    6. buildID
    7. clipboard
    8. connection
    9. cookieEnabled
    10. credentials
    11. deviceMemory
    12. doNotTrack
    13. geolocation
    14. keyboard
    15. 语言
    16. languages
    17. locks
    18. maxTouchPoints
    19. mediaDevices
    20. mediaSession
    21. onLine
    22. oscpu
    23. permissions
    24. platform
    25. product
    26. productSub
    27. serviceWorker
    28. userAgent
    29. vendor
    30. vendorSub
    31. webdriver
    32. xr
  3. 方法
    1. canShare()
    2. getBattery()
    3. getGamepads()
    4. getUserMedia()
    5. getVRDisplays()
    6. mozIsLocallyAvailable()
    7. msLaunchUri()
    8. registerContentHandler()
    9. registerProtocolHandler()
    10. requestMediaKeySystemAccess()
    11. sendBeacon()
    12. share()
    13. taintEnabled()
    14. vibrate()
  4. HTML DOM 相关页面
    1. BeforeUnloadEvent
    2. DOMStringMap
    3. ErrorEvent
    4. GlobalEventHandlers
    5. HTMLAnchorElement
    6. HTMLAreaElement
    7. HTMLAudioElement
    8. HTMLBRElement
    9. HTMLBaseElement
    10. HTMLBaseFontElement
    11. HTMLBodyElement
    12. HTMLButtonElement
    13. HTMLCanvasElement
    14. HTMLContentElement
    15. HTMLDListElement
    16. HTMLDataElement
    17. HTMLDataListElement
    18. HTMLDialogElement
    19. HTMLDivElement
    20. HTMLDocument
    21. HTMLElement
    22. HTMLEmbedElement
    23. HTMLFieldSetElement
    24. HTMLFormControlsCollection
    25. HTMLFormElement
    26. HTMLFrameSetElement
    27. HTMLHRElement
    28. HTMLHeadElement
    29. HTMLHeadingElement
    30. HTMLHtmlElement
    31. HTMLIFrameElement
    32. HTMLImageElement
    33. HTMLInputElement
    34. HTMLIsIndexElement
    35. HTMLKeygenElement
    36. HTMLLIElement
    37. HTMLLabelElement
    38. HTMLLegendElement
    39. HTMLLinkElement
    40. HTMLMapElement
    41. HTMLMediaElement
    42. HTMLMetaElement
    43. HTMLMeterElement
    44. HTMLModElement
    45. HTMLOListElement
    46. HTMLObjectElement
    47. HTMLOptGroupElement
    48. HTMLOptionElement
    49. HTMLOptionsCollection
    50. HTMLOutputElement
    51. HTMLParagraphElement
    52. HTMLParamElement
    53. HTMLPictureElement
    54. HTMLPreElement
    55. HTMLProgressElement
    56. HTMLQuoteElement
    57. HTMLScriptElement
    58. HTMLSelectElement
    59. HTMLShadowElement
    60. HTMLSourceElement
    61. HTMLSpanElement
    62. HTMLStyleElement
    63. HTMLTableCaptionElement
    64. HTMLTableCellElement
    65. HTMLTableColElement
    66. HTMLTableDataCellElement
    67. HTMLTableElement
    68. HTMLTableHeaderCellElement
    69. HTMLTableRowElement
    70. HTMLTableSectionElement
    71. HTMLTemplateElement
    72. HTMLTextAreaElement
    73. HTMLTimeElement
    74. HTMLTitleElement
    75. HTMLTrackElement
    76. HTMLUListElement
    77. HTMLUnknownElement
    78. HTMLVideoElement
    79. HashChangeEvent
    80. 历史
    81. ImageData
    82. 定位
    83. MessageChannel
    84. MessageEvent
    85. MessagePort
    86. NavigatorGeolocation
    87. NavigatorID
    88. NavigatorLanguage
    89. NavigatorOnLine
    90. NavigatorPlugins
    91. PageTransitionEvent
    92. Plugin
    93. PluginArray
    94. PopStateEvent
    95. PortCollection
    96. PromiseRejectionEvent
    97. RadioNodeList
    98. Transferable
    99. ValidityState
    100. Window
    101. WindowBase64
    102. WindowEventHandlers
    103. WindowTimers

版权所有  © 2014-2026 乐数软件    

工业和信息化部: 粤ICP备14079481号-1