Fixed PWA on iOS 27
This commit is contained in:
1 parent
c575a8dcba
commit
a39f97a4be
5 files changed
+43
-4
No files matched your search
@@ -17,11 +17,34 @@ const page = usePage<SharedProps>().props
|
||||
router.on('success', () => {
|
||||
transitionKey.value++;
|
||||
});
|
||||
|
||||
const isIOS27PlusPWA = (() => {
|
||||
const ua = navigator.userAgent;
|
||||
|
||||
const isStandalone =
|
||||
window.matchMedia('(display-mode: standalone)').matches ||
|
||||
(navigator as Navigator & { standalone?: boolean }).standalone;
|
||||
|
||||
if (!isStandalone) return false;
|
||||
|
||||
// iPhone / iPad detection
|
||||
const isIOS =
|
||||
/iPhone|iPad|iPod/.test(ua) ||
|
||||
(navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1);
|
||||
|
||||
if (!isIOS) return false;
|
||||
|
||||
// iOS 27+ detection (Safari version token)
|
||||
const version = ua.match(/Version\/(\d+)/);
|
||||
|
||||
return version && parseInt(version[1]) >= 27;
|
||||
})();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Radar>
|
||||
<div class="layoutContainer">
|
||||
<div v-if="isIOS27PlusPWA" class="ios-top-bar"></div>
|
||||
<MainHeader :key="`header-${transitionKey}`" />
|
||||
<Transition name="fade" mode="out-in">
|
||||
<main id="pageContainer" :key="`main-${transitionKey}`">
|
||||
@@ -49,6 +72,16 @@ router.on('success', () => {
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.ios-top-bar {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 6px;
|
||||
z-index: 9999;
|
||||
background: var(--surface);
|
||||
}
|
||||
|
||||
header,
|
||||
footer {
|
||||
flex: 0 0 5dvh;
|
||||
|
||||
Reference in new issue
Block a user