From f4e495b3b2080832466c817f06b702d76c1e1759 Mon Sep 17 00:00:00 2001 From: Henry Fontanier Date: Tue, 19 Dec 2023 16:01:42 +0100 Subject: [PATCH] fix: try something --- front/iosSafariAutoscrollBack.ts | 12 ++++++++++++ front/pages/_app.tsx | 2 ++ 2 files changed, 14 insertions(+) create mode 100644 front/iosSafariAutoscrollBack.ts diff --git a/front/iosSafariAutoscrollBack.ts b/front/iosSafariAutoscrollBack.ts new file mode 100644 index 0000000000000..76b8dba52bd67 --- /dev/null +++ b/front/iosSafariAutoscrollBack.ts @@ -0,0 +1,12 @@ +export default function enable() { + const ua = window.navigator.userAgent; + const iOS = !!ua.match(/iPad/i) || !!ua.match(/iPhone/i); + const webkit = !!ua.match(/WebKit/i); + const iOSSafari = iOS && webkit && !ua.match(/CriOS/i); + + if (iOSSafari) { + window.alert( + "You are using iOS Safari. Please use Chrome or Firefox for the best experience." + ); + } +} diff --git a/front/pages/_app.tsx b/front/pages/_app.tsx index 116a2f75c295f..8c64bcc4ed144 100644 --- a/front/pages/_app.tsx +++ b/front/pages/_app.tsx @@ -7,6 +7,7 @@ import { SessionProvider } from "next-auth/react"; import { MouseEvent, ReactNode } from "react"; import { NotificationArea } from "@app/components/sparkle/Notification"; +import enableSafariAutoscrollBack from "@app/iosSafariAutoscrollBack"; function NextLinkWrapper({ href, @@ -48,6 +49,7 @@ export default function App({ Component, pageProps: { session, ...pageProps }, }: AppProps) { + enableSafariAutoscrollBack(); return (