Author: LUO Hao, UC International Research and Development
Welcome to the “UC International Technology” public account, we will provide you with the client, server, algorithm, testing, data, front-end and other related high-quality technical articles, not limited to original and translation.
preface
In recent years, with the rapid development of the Internet, people pay more and more attention to personal privacy. Today let me take you through the “Do Not Track API”, our daily use of browsers, how to Do privacy protection.
The Do Not Track API, as its name implies, has an interface that you can set to Not Track user behavior. Our first reaction might be: as long as the relevant Settings are made, the data such as cookies will not be recorded.
No, the Do Not Track API is Not a browser privacy mode, although it is also closely related to user privacy, but there are obvious differences, let me slowly explain.
The history of Do Not Track
When it comes to Do Not Track, one of the first ones to Do it was Internet Explorer 9, which came out of the blue in 2010, and then Firefox came out in 2011, Chrome added support in 2012. As you can see, browsers have supported Do not track at a very early time.
Would it be weird? This API has been around for more than eight years and seems to have never been mentioned, and it’s estimated that 90% of frontend don’t even know that browsers have it. Why is that? Let’s keep watching.
Turn on “Do Not Track” in browser
By default, the browser does not enable Do not track, that is, there is no prohibition not to track, we need to manually enable. For example, in Chrome, we can set – Advanced and then “send ‘do not track’ request along with browsing traffic”, as shown in the screenshot below:
>> Chrome sends a “Do not track” request <<
Click on the switch button and we will see the following prompt (the prompt text may change depending on the browser) :
>> Chrome does not track prompts <<
The text version is as follows:
If you enable Do not Track, it means that your browsing traffic will contain a request. Any impact depends on whether the site responds to the request and how it is interpreted. For example, some web sites may show you ads after receiving this request that are not based on other web sites you have visited. Many sites still collect and use your browsing data for purposes such as improving security, providing relevant content, services, advertising, and recommendations, and generating report statistics.
Can’t make out what’s being said? I use Chinese to translate again is:
If you enable “Do Not Track”, we will send a “Do Not Track” request header to the server, and how this will affect your browsing page depends on how the site handles this request. Some websites pay more attention to the user’s privacy, the advertising is random, will not appear in Taobao to check the funeral supplies, and then full screen coffin advertising (typical advertising based on user privacy). Of course, some sites will collect your browsing data for good reasons, such as providing better service or making your account more secure.
If we put it more bluntly:
Dear users, if you enable “do not track”, our browser will do its best to send information to both the web server and the client that the user does not want to be tracked. Whether the site you visit respects your Settings is beyond our control!
So far, we can understand why Do Not Track has been ignored for more than eight years. Because whether this thing has effect completely depends on whether Internet company is conscious!
Considering that in China, it is even worse, what user privacy ah, not to mention the vast majority of website managers, products, and even developers do not know browser “do not track”, even if they know there is such a thing, and users will go to set, we will choose to ignore. China’s Internet privacy that is is Not keen, before “robin said China users to exchange privacy for convenience”, after “Meituan review will show you where is the friend of points in a meal, to live what hotel”, “Do Not Track”, what is the deaf ears, decoration, in China, is there any difference between with and without? No use, don’t care, naturally no one cares.
However, from the comments of netizens in many events in recent years, privacy has become more and more concerned about this matter, which day will be placed on the table to become a very important issue for fermentation! Therefore, if a site can clearly respect the privacy of its users, the impact of the site and the reputation of the company may explode. Isn’t there a saying on the Internet? I’m not the best. I’m the best.
What can front-end development do
The browser provides the Do Not Track API on the front end, which lets the front end developer know if the user has Enabled Do Not Track.
The HTML5 API is navigator.doNotTrack, IE9 and IE10 also require the private prefix navigator.msDoNotTrack, and then IE11+ for whatever reason, Use window.doNotTrack instead of navigator.doNotTrack.
In addition to the API name details, there are also differences in the return value of the doNotTrack attribute, as detailed in the following table:
That is, in all browsers, if the user has Do not Track enabled, the API returns a value of ‘1’; If It is not enabled, Internet Explorer 9, Internet Explorer 10 return 0, Internet Explorer 11+ and Chrome return NULL, and Firefox returns Unspecified.
Therefore, we can merge logically to know if the user is “not tracking” :
Now you can put it into practice. For example, many searches have a history search, and if the user chooses “privacy Do not track,” the actual history search list will say: “Since you chose privacy tracking protection, we will not record your search history!”
For example, the search history of Sina Weibo would look something like this:
How nice! A look is to respect user choice, pay attention to privacy of the good company, good products! Please respect the choice of users, your self-righteous feelings can not represent the real voice of users. Just like when my parents think they are good for you, many times a lot of burden!
conclusion
Privacy is essentially a part of the user experience, and as the front end, who works closely with the user, it’s important to keep an eye on it. It doesn’t matter if you use it or not, but it’s nice to know that there is one, and at least have awareness of it.
Good article recommendation:
What will the 2019 front-end interview talk about? Take a look
The 2018 JavaScript Trends Report is here!
UC International Technology is committed to sharing high quality technical articles with you
Please follow our official account and share this article with your friends