Is this HTML/Js correct because it just rapidly asks if I want notifications instead of sending them after I click allow.
HTML:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Notification System</title>
<script src="script.js" defer></script>
</head>
<body>
<button>click</button>
</body>
</html>
Js:
const button = document.querySelector("button")
button.addEventListener("click", () => {
Notification.requestPermission().then(perm =>{
if (perm === "granted") {
new Notification("Testing Testing 123", {
body: "bolls"
})
}
})
})