- From: RobertMPop <notifications@github.com>
- Date: Wed, 14 May 2025 09:16:03 -0700
- To: w3c/manifest <manifest@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <w3c/manifest/issues/1041/2880814321@github.com>
RobertMPop left a comment (w3c/manifest#1041) > To anyone looking for a solution, here is what we implemented for a Framework7 Vue PWA app, within the main app mounted() function: > > ``` > // Disable the 'swipe to back' gesture on iOS > const firstDiv = document.querySelector('div'); > if (firstDiv) { > firstDiv.addEventListener('touchstart', (e) => { > let x = e.pageX; > // If pageX does not exist, try touches[0].pageX > if (!x) x = e.touches[0].pageX; > // is not near edge of view, exit > if (x > 20 && x < window.innerWidth - 20) return; > // prevent swipe to navigate back gesture > e.preventDefault(); > }); > } > ``` > This is a very specific solution for a specific problem, so use with caution and testing (as always). This is not a foolproof solution. For instance, if you try to swipe back while the page is still scrolling, you would be able to navigate back to the previous page because the native behavior overrides your JS code and thus you cannot prevent it. This is most likely an issue at iOS/WebKit level and they still haven't fixed it. On the other side, Android understood from the very beginning the purpose of PWAs and so the native swipe back is disabled by default (you don't even need a separate manifest rule for it). -- Reply to this email directly or view it on GitHub: https://github.com/w3c/manifest/issues/1041#issuecomment-2880814321 You are receiving this because you are subscribed to this thread. Message ID: <w3c/manifest/issues/1041/2880814321@github.com>
Received on Wednesday, 14 May 2025 16:16:11 UTC