We Are Finally Using The Do-Not-Track Web Browser Header

From LinuxReviews
Jump to navigationJump to search

Modern web browsers can send a Do-Not-Track (DNT) header to websites when they request web pages. We now use this little-used HTTP header to decide if you should be served advertisements or not. You may want to tell your web browser to send that header if you visit this website regularly. None of the major browsers enable it by default.

written by 윤채경 (Yoon Chae-kyung)  2020-07-21 - last edited 2020-07-21. © CC BY

We now do a close-up inspection of the headers your web browser sends us and use that information to decide if you should be served with lots of advertisements.

The Do-Not-Track http header is a completely optional header web browsers can send websites when they ask websites to send them a web page. Major web browsers do not send this header by default.

Checking to see if the header is used server-side in PHP is very easy. Just check if $_SERVER['HTTP_DNT'] is set to true and act accordingly:

if ( isset($_SERVER['HTTP_DNT']) 
        && $_SERVER['HTTP_DNT'] == true ){
        $showAdvertisingOnPage = false;

Most Web Browsers Disable Do-Not-Track By Default

Mozilla Firefox supports sending a Do-Not-Track header when it requests a web page but the functionality is not enabled by default. It can be turned on using the about:preferences#privacy page found under Edit ▸ Preferences ▸ Privacy & Security. There you will find the option "Send websites a “Do Not Track” signal that you don’t want to be tracked" half-way down on that page. It should be set to Always instead of the Only when Firefox is set to block known trackers default.

The Do-Not-Track switch in Chromium is hidden under Privacy and security ▸ More.

Chromium based browsers have the Do-Not-Track setting hidden under Settings ▸ Privacy and security ▸ More. Flip the switch Send a "Do Not Track" request with your browsing traffic to send a Do-Not-Track request to websites when it requests pages.

Most Websites Do Not Care, Not Even A Little

The Do-Not-Track header is not only optional client-side, it is also completely optional server-side. Very few websites bother checking if the header is present and, if it is, what it is set to. We didn't bother using it for anything on this site until now. It is, after all, a completely optional feature.

Asking your web browser to send the Do-Not-Track header will not do any harm so you might as well do it, but do not expect it to make advertisements magically disappear on the vast majority of the websites you visit. They won't. You will need to install a web filter like Ublock Origin and configure it to use some additional blacklists and rules to get rid of all the advertisements, web trackers and cookie warnings the modern web is riddled with. Installing Ublock Origin is generally a very good idea but it does have one downside: Using the web will feel unbearable if you are used to having it installed at home and you have to use a web browser without it somewhere else. You should also consider that most websites make close to nothing these days because so many choose to steal the precious content instead of paying for it by viewing advertisements like mindless slaves good consumers.

(one vote)



17 months ago
Score 1++

> $_SERVER['HTTP_DNT'] == true

Don't you just love a language where the string value "1" can be equal to a boolean?
Add your comment
LinuxReviews welcomes all comments. If you do not want to be anonymous, register or log in. It is free.