Last active
June 3, 2018 09:54
-
-
Save hampusborgos/08fa29d4317718c72d3e to your computer and use it in GitHub Desktop.
How to respect Do Not Track header and ignore IE
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Respect do not track for all browsers. Except for IE 10 and 11 where we ignore it | |
var dnt_isIe10or11 = (navigator.appVersion.indexOf("MSIE 10") !== -1) || (navigator.userAgent.indexOf("Trident") !== -1 && navigator. userAgent.indexOf("rv:11") !== -1); | |
var DNT = (navigator.doNotTrack || navigator.msDoNotTrack || window.doNotTrack); | |
DNT = !DNT || DNT == "unspecified" || DNT == "0" ? false : true; | |
if (!DNT || dnt_isIe10or11) { | |
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); | |
// GA loading code | |
} |
@sacredwx :
https://hjnilsson.com/2015/11/30/setting-up-dnt/
Microsoft has made IE 10 & 11 set the value to true by default, in violation of the standard
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Why to cut off IE 10 and 11 ?