0
I have this script ajax
that refreshes the screen and calls the notifyMe()
and the notification is displayed. But I noticed that clicking opens the page in another tab. I want when clicked on the notification to open in the same tab as this notification and not to open a new one.
<script>
// request permission on page load
document.addEventListener('DOMContentLoaded', function () {
if (!Notification) {
alert('Desktop notifications not available in your browser. Try Chromium.');
return;
}
if (Notification.permission !== "granted")
Notification.requestPermission();
});
function notifyMe() {
if (Notification.permission !== "granted")
Notification.requestPermission();
else {
var notification = new Notification('DIAZERO SECURITY', {
icon: '<?php url(); ?>/favicon.png',
body: "Sua solicitação foi atualizada!",
});
notification.onclick = function () {
window.open("<?php url(); ?>/solicitacao/<?php echo $a; ?>");
};
}
}
</script>
opa very good solved thank you very much ^^
– Jasar Orion