about summary refs log tree commit diff
path: root/src/lib/browser.ts
diff options
context:
space:
mode:
authorHailey <me@haileyok.com>2024-05-23 08:45:24 -0700
committerGitHub <noreply@github.com>2024-05-23 16:45:24 +0100
commitd0516143423afaf6fe9c6db71ee67e5aef99b013 (patch)
treeec2ed99a6e9fbed68c9f7107213931dc483a67b1 /src/lib/browser.ts
parent2c6c906934a0b567e4e63025d1f69d534776b79d (diff)
downloadvoidsky-d0516143423afaf6fe9c6db71ee67e5aef99b013.tar.zst
implement a safari hack for ime (#4186)
remove debug logs

use a better hack

implement a safari hack

extract `isSafari` and `isFirefox` to a global variable
Diffstat (limited to 'src/lib/browser.ts')
-rw-r--r--src/lib/browser.ts6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/lib/browser.ts b/src/lib/browser.ts
new file mode 100644
index 000000000..d5ecb4e85
--- /dev/null
+++ b/src/lib/browser.ts
@@ -0,0 +1,6 @@
+// https://stackoverflow.com/questions/7944460/detect-safari-browser
+export const isSafari = /^((?!chrome|android).)*safari/i.test(
+  navigator.userAgent,
+)
+
+export const isFirefox = /firefox|fxios/i.test(navigator.userAgent)