Understanding the Do Not Track API: History, Browser Support, and Front‑End Implementation
This article explains the history, browser support, and practical front‑end implementation of the Do Not Track API, showing how to enable it, interpret its return values across browsers, and apply it to respect user privacy in web applications.
In recent years, growing concerns about personal privacy have prompted browsers to offer a "Do Not Track" (DNT) feature. The DNT API allows web pages to detect whether a user has enabled this setting, but it is not the same as private browsing.
The first browser to support DNT was Internet Explorer 9 in 2010, followed by Firefox in 2011 and Chrome in 2012. Despite being available for over eight years, many front‑end developers are still unaware of its existence.
By default, browsers do not send a DNT request. Users must manually enable it; for example, in Chrome you can enable it via Settings → Advanced → "Send a "Do Not Track" request with your browsing traffic". When enabled, the browser adds a DNT header to outgoing requests.
The DNT header informs the server that the user does not wish to be tracked. How the server reacts is up to its implementation: some may serve non‑personalised ads, while others may still collect data for security or service improvement.
Different browsers expose the DNT status through slightly different JavaScript properties: navigator.doNotTrack in most browsers, navigator.msDoNotTrack in IE9/IE10, and window.doNotTrack in IE11+. The returned values also vary: a value of "1" means DNT is enabled; "0" (IE9/IE10) or null (IE11+, Chrome) means disabled; Firefox returns "unspecified" when the user has not made a choice.
Developers can normalise these values with a simple logic check (illustrated in the original article with a diagram) to determine whether the user has opted out of tracking.
Once the DNT status is known, it can be used in practical scenarios. For instance, a search feature could hide the user's search history when DNT is enabled, displaying a message such as "Because you chose privacy protection, we will not record your search history." The article shows a screenshot of how this looks on a Chinese social platform.
The piece also discusses the broader context of privacy in China, noting that many companies ignore DNT signals, but public awareness is increasing and privacy may become a more prominent issue.
In conclusion, while the Do Not Track API is a simple tool, front‑end developers should be aware of it and consider respecting user privacy as part of the overall user experience.
UC Tech Team
We provide high-quality technical articles on client, server, algorithms, testing, data, front-end, and more, including both original and translated content.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.