Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix doNotTrack polyfill #87

Merged
merged 2 commits into from
Nov 10, 2020
Merged

fix: fix doNotTrack polyfill #87

merged 2 commits into from
Nov 10, 2020

Conversation

tim-yao
Copy link
Contributor

@tim-yao tim-yao commented Nov 3, 2020

Issue Description

The doNotTrack pollyFill code snippet from https://gist.github.com/pi0/a76fd97c4ea259c89f728a4a8ebca741 is not working for me if window.doNotTrack is 0 but navigator.doNotTrack is 1. That is Chrome behaviour, that means this DNT validation is not working for most of the users.

The parameter n get a string value 'navigator', which is used as an object in n[d] and n[m]. As a result, it returns undefined instead of expected result 1 or 0.

Solution

Change the argument to navigator instead of 'navigator' fixes the issue for me.

I also found window.external.msTrackingProtectionEnabled part has mistake as well. Fixed in second commit.

@tim-yao tim-yao marked this pull request as ready for review November 3, 2020 06:58
@tim-yao tim-yao changed the title fix: dnt not working issue fix: dnt pollyFill not working issue Nov 3, 2020
@pi0 pi0 changed the title fix: dnt pollyFill not working issue fix: fix doNotTrack polyfill Nov 10, 2020
@pi0 pi0 merged commit c69d1cf into nuxt-community:master Nov 10, 2020
@pi0
Copy link
Member

pi0 commented Nov 10, 2020

Thanks @tim-yao <3 Also updated gist

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants