From 9db6557de491fd2cdf9fa74a3057d428fae479e1 Mon Sep 17 00:00:00 2001 From: Jeon Eonseok Date: Tue, 22 Oct 2024 10:26:03 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20chrome=20=ED=8C=90=EB=8B=A8=20regex=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/hooks/useCheckBrowser.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/common/hooks/useCheckBrowser.ts b/src/common/hooks/useCheckBrowser.ts index 7d942b6c..6606939e 100644 --- a/src/common/hooks/useCheckBrowser.ts +++ b/src/common/hooks/useCheckBrowser.ts @@ -2,7 +2,18 @@ import { useEffect } from 'react'; const useCheckBrowser = () => { useEffect(() => { - const isChrome = /Chrome/i.test(window.navigator.userAgent); + const userAgent = window.navigator.userAgent; + + const chromeRegexes = [ + /\b(?:crmo|crios)\/([\w\.]+)/i, // Chrome for Android/iOS + /headlesschrome(?:\/([\w\.]+)| )/i, // Chrome Headless + / wv\).+(chrome)\/([\w\.]+)/i, // Chrome WebView + /chrome\/([\w\.]+) mobile/i, // Chrome Mobile + /(cros) [\w]+(?:\)| ([\w\.]+)\b)/i, // ChromeOS (Chromium OS) + ]; + + const isChrome = chromeRegexes.some((regex) => regex.test(userAgent)); + if (!isChrome) { alert('원활한 지원을 위해 크롬(Chrome) 브라우저 사용을 권장드려요.'); }