From 988bc39bb9fecec20f52d00b4fade75dc8903d81 Mon Sep 17 00:00:00 2001 From: LarsFlem <43146722+LarsFlem@users.noreply.github.com> Date: Wed, 23 Oct 2024 14:13:47 +0200 Subject: [PATCH] Update PDF.tsx --- src/components/PDF.tsx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/components/PDF.tsx b/src/components/PDF.tsx index e373d4b..717d4db 100644 --- a/src/components/PDF.tsx +++ b/src/components/PDF.tsx @@ -11,12 +11,11 @@ const PdfViewer: React.FC = () => { const objectRef = useRef(null); // Ref for object useEffect(() => { - const userAgent = navigator.userAgent || navigator.vendor || window.opera; + const userAgent = navigator.userAgent || navigator.vendor; - // Detect iOS (iPhone/iPad) - if (/iPad|iPhone|iPod/.test(userAgent) && !(window as any).MSStream) { - setIsIOS(true); - } + // Detect iOS (iPhone/iPad) - updated condition to not use window.opera + const isIOSDevice = /iPad|iPhone|iPod/.test(userAgent); + setIsIOS(isIOSDevice); }, []); return (