File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -122,7 +122,6 @@ export default defineConfig({
122122 svelte ( ) ,
123123 serviceWorker ( {
124124 workbox : { inlineWorkboxRuntime : true } ,
125- enableInDevelopment : true ,
126125 } ) ,
127126 compress ( {
128127 HTML : false ,
Original file line number Diff line number Diff line change 66</div >
77<script is:inline >
88
9- document.addEventListener('astro:page-load ', () => {
9+ document.addEventListener('DOMContentLoaded ', () => {
1010 const offlineIcon = document.getElementById('offline-icon');
1111
1212 function updateOnlineStatus() {
1717 window.addEventListener('online', updateOnlineStatus);
1818 window.addEventListener('offline', updateOnlineStatus);
1919
20- // Initial check
2120 updateOnlineStatus();
2221 }
2322 );
Original file line number Diff line number Diff line change @@ -117,4 +117,27 @@ if ("serviceWorker" in navigator) {
117117 });
118118 });
119119}
120+
121+ if (window.matchMedia('(display-mode: standalone)').matches) {
122+ document.addEventListener('click', function (e: any) {
123+ const anchor = e.target.closest('a');
124+
125+ if (!anchor || !anchor.href) return;
126+
127+ const origin = window.location.origin;
128+ const href = anchor.getAttribute('href');
129+
130+ if (
131+ href.startsWith('#') ||
132+ href.startsWith('/') ||
133+ href.startsWith(origin)
134+ ) {
135+ return;
136+ }
137+
138+ e.preventDefault();
139+
140+ alert('External links are available only via website.');
141+ });
142+ }
120143</script >
You can’t perform that action at this time.
0 commit comments