1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| <!DOCTYPE html> <html lang="zh-cn">
<head> <meta charset="utf-8"> <title>Notification</title> <meta name="viewport" content="width=device-width, initial-scale=1"> </head>
<body> <script> // 检查用户是否同意接受通知 if (Notification.permission !== "granted") { Notification.requestPermission() }
new Notification("同意了,通知一个"); </script> </body>
</html>
|