I am using below example.it show show me chrome
notification default.but when I click on button it doesn't show show me notification why ?
https://developer.mozilla.org/en-US/docs/Web/API/notification
I am using 83 v chrome
and mac
I used two example first one is simple
and second one to get permission then show .both are not working
here is my code
https://codesandbox.io/s/nostalgic-tdd-9kto3?file=/src/App.js:249-1123
<button
onClick={() => {
var notification = new Notification("Hi there!");
// another example
// if (!("Notification" in window)) {
// alert("This browser does not support desktop notification");
// }
// // Let's check whether notification permissions have already been granted
// else if (Notification.permission === "granted") {
// // If it's okay let's create a notification
// var notification = new Notification("Hi there!");
// }
// // Otherwise, we need to ask the user for permission
// else if (Notification.permission !== "denied") {
// Notification.requestPermission().then(function(permission) {
// // If the user accepts, let's create a notification
// if (permission === "granted") {
// var notification = new Notification("Hi there!");
// }
// });
// }
}}
>
notify
</button>