const notification = new Notification("New message from Alice", {
body: "Hey, are you free for lunch?",
navigate: "/messages/alice",
});
// The property contains the resolved absolute URL
console.log(notification.navigate); // e.g. "https://example.com/messages/alice"
// Without a navigate option, the property is an empty string
const basic = new Notification("Hello!");
console.log(basic.navigate); // ""Notification: navigate property / notebook
Notification: navigate property
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
// Inside a service worker
self.registration.showNotification("Order shipped!", {
body: "Your order #1234 has been shipped.",
navigate: "/orders/1234",
});