Skip to content

Commit

Permalink
FXA-7936 - Fix DNT check in Safari (#1803)
Browse files Browse the repository at this point in the history
`window.external` is [not available in Safari](https://developer.mozilla.org/en-US/docs/Web/API/Window/external#browser_compatibility).
We need to check if it exists before calling it in order to not break the page load.
  • Loading branch information
akkomar authored Jul 11, 2023
1 parent 73cbdcd commit f962462
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/telemetry/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ const isDNTEnabled =
navigator.doNotTrack === "yes" ||
navigator.doNotTrack === "1" ||
navigator.msDoNotTrack === "1" ||
("msTrackingProtectionEnabled" in window.external &&
(typeof window.external !== "undefined" &&
"msTrackingProtectionEnabled" in window.external &&
window.external.msTrackingProtectionEnabled());

/**
Expand Down

0 comments on commit f962462

Please sign in to comment.