console
function notifyMe() {
if (!("Notification" in window)) {
alert("This browser does not support desktop notification");
} else if (Notification.permission === "granted") {
const notification = new Notification("Hi there!111",{ requireInteraction:true ,icon:"https://b.scm321.com/favicon.ico",image:"https://b.scm321.com/Content/images/nlogo-pure.png"});
notification.addEventListener("click",function(){
window.open("http://baidu.com")
});
} else if (Notification.permission !== "denied") {
Notification.requestPermission().then((permission) => {
if (permission === "granted") {
const notification = new Notification("Hi therefdafd!");
}
});
}
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=, initial-scale=">
<meta http-equiv="X-UA-Compatible" content="">
<title></title>
</head>
<body>
<button onclick="notifyMe()">Notify me!</button>
</body>
</html>