Is there a way to detect if a web page is loaded with SFSafariViewController
vs the normal Safari Browser using Javascript?
Asked
Active
Viewed 200 times
0
2 Answers
0
You can check for the existence of the obscure system font .Helvetica LT MM
in a canvas. Use the following Github Gist, and then call isInsideSFSafariViewController()
.
Note that this can break at any time with a new release, so your code should gracefully fall back.
https://gist.github.com/aeharding/08eaafbb7742f78ede9b8d2f5d096354

aeharding
- 486
- 1
- 4
- 13
-2
@supports (-webkit-touch-callout: none) {
/* CSS specific to iOS devices */
}
@supports not (-webkit-touch-callout: none) {
/* CSS for other than iOS devices */
}

Joundill
- 6,828
- 12
- 36
- 50

Rikhil Shah
- 58
- 5
- 10
-
Please add some explanation to your answer such that others can learn from it – Nico Haase Dec 02 '21 at 15:51
-
Thanks for the answer! But this seems to help us to differentiate between iOS and non iOS, which is not what I'm looking for. – o-vexler Dec 04 '21 at 13:51