fix: detect safari when launching from dock #1356
Merged
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.
safari v.17 (macOS v.14) introduce a new feature to save any webpage as a web app. The app is added to the dock and can be used independently from safari. Hower this app still use safari engine under the hood. It appears that when using safari in a webapp property "window.safari" is undefined.
As the detection of safari browser rely on this property, the browser is mistakenly considered as non safari.
The goal of this change is to rely on userAgent that may be more reliable.
https://support.apple.com/en-us/104996
https://developer.mozilla.org/en-US/docs/Web/HTTP/Browser_detection_using_the_user_agent#which_part_of_the_user_agent_contains_the_information_you_are_looking_for