Skip to content

Commit 61b3f85

Browse files
committed
Use alert
1 parent 2ff4af0 commit 61b3f85

File tree

1 file changed

+3
-19
lines changed

1 file changed

+3
-19
lines changed

src/layouts/Layout.astro

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -107,24 +107,13 @@ footer {
107107
if ("serviceWorker" in navigator) {
108108
window.addEventListener("load", () => {
109109
navigator.serviceWorker.register("/service-worker.js").then((registration) => {
110-
registration.pushManager.getSubscription()
111-
112-
self.addEventListener("push", (event: any) => {
113-
const payload = event.data?.text() ?? "no payload";
114-
event.waitUntil(
115-
registration.showNotification("EP 2025", {
116-
body: payload,
117-
}),
118-
);
119-
});
120-
110+
console.log("ServiceWorker registered: ", registration);
121111
}).catch((registrationError) => {
122112
console.log("ServiceWorker registration failed: ", registrationError);
123113
});
124114
});
125115
}
126116

127-
128117
document.addEventListener('DOMContentLoaded', () => {
129118
if (window.matchMedia('(display-mode: standalone)').matches) {
130119
document.addEventListener('click', function (e: Event) {
@@ -156,13 +145,8 @@ document.addEventListener('DOMContentLoaded', () => {
156145
e.stopPropagation();
157146
anchor.href = "";
158147

159-
const message = 'External links are disabled in standalone mode. Please visit the website to access external content.';
160-
161-
if (typeof window !== 'undefined' && 'Notification' in window && Notification.permission === 'granted') {
162-
new Notification('External Link Blocked', { body: message });
163-
} else {
164-
alert(message);
165-
}
148+
const message = 'Please visit the website to access external content.';
149+
alert(message);
166150
}, { passive: false });
167151
}
168152
});

0 commit comments

Comments
 (0)