Alex-D / Cookies-EU-banner

1kb vanilla JS script which manages cookies consent banner display like asked by GDPR
http://alex-d.github.io/Cookies-EU-banner/
MIT License
439 stars 57 forks source link

Chrome 60 without DNT is identified as "to track" #23

Closed agross closed 7 years ago

agross commented 7 years ago

Chrome 60, I disabled DNT in settings. this.isToTrack() returns undefined which is then negated to true.

isToTrack: function () {
      var dnt = navigator.doNotTrack || navigator.msDoNotTrack || window.doNotTrack; // dnt === undefined
      return (dnt !== null) ? (dnt && dnt !== 'yes' && dnt !== 1 && dnt !== '1') : true; // dnt && dnt !== 'yes' && dnt !== 1 && dnt !== '1' === undefined
    },
agross commented 7 years ago

I tested a bit more with Chrome and Edge:

In Chrome dnt === undefined, hence (dnt !== null) === true .

In Edge, dnt === null, hence (dnt !== null) === false.

Alex-D commented 7 years ago

Should be fixed in 1.2.9.

agross commented 7 years ago

Thank you!