dennisdev / rs-map-viewer

A webapp for exploring current and historical versions of RuneScape
https://osrs.world
BSD 2-Clause "Simplified" License
52 stars 12 forks source link

"iOS is not supported." message appears on iOS Chrome but not iOS Safari #4

Closed elliotwutingfeng closed 10 months ago

elliotwutingfeng commented 10 months ago

Model: iPad Pro 2022 12.9 inch OS: iPadOS 17.2

Expected behavior: "iOS is not supported." message should be displayed on iOS Safari, just like how it currently does on iOS Chrome.

Actual: iOS Safari browser attempts to load the site for a while before crashing.

dennisdev commented 10 months ago

Thank you for reporting this, it seems like iPad safari pretends to be on desktop https://developer.apple.com/forums/thread/119186

Can you check if it detects it correctly now?

elliotwutingfeng commented 10 months ago

Yes the correct error message shows up on iPadOS 17.2 Safari now. I think iOS Safari (for iphones) also pretend to be desktop as well.

const isIpad = navigator.userAgent.includes("Macintosh") && navigator.maxTouchPoints >= 1;

It should hopefully work on iOS 12 (still supported by Apple) as well because navigator.maxTouchPoints is undefined on iOS 12 and below, but the && prevents that from being evaluated. I don't have an iOS 12 device though.