Back
Syntax
Study
Editor
Mode:
HTML
CSS
JavaScript
PHP
Reset
Run »
HTML / CSS / JS
async function showNotification() { const permission = await Notification.requestPermission(); if (permission === "granted") { new Notification("New Message", { body: "You have a message from Alice.", icon: "/img/icon.png", badge: "/img/badge.png" }); } } document.getElementById("notifyBtn").addEventListener("click", showNotification);
Result
Open