calendar-image/demo.html
vitrinekast 7fb74e29dd pass a date
2025-08-05 18:51:32 +02:00

31 lines
827 B
HTML

<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
</head>
<body>
<button class="notify">send a notification</button>
<script>
const Notifybtn = document.querySelector(".notify");
const sendNotification = () => {
if (!("Notification" in window)) {
throw new Error(
"Your browser does not support push notification",
);
}
Notification.requestPermission().then((Permission) => {
const notificationOptions = {
body: "Welcome to Javascript Push Notification",
icon: "./image.png",
};
new Notification("Push Notification", notificationOptions);
});
};
Notifybtn.addEventListener("click", sendNotification);
</script>
</body>
</html>