Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue Description
The
doNotTrack
pollyFill code snippet from https://gist.github.com/pi0/a76fd97c4ea259c89f728a4a8ebca741 is not working for me ifwindow.doNotTrack
is0
butnavigator.doNotTrack
is1
. 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 inn[d]
andn[m]
. As a result, it returnsundefined
instead of expected result1
or0
.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.