javascript - pushUp Notification not too frequent and browser allow -


hello using code browser/desktop pushup notification

  document.addeventlistener('domcontentloaded', function () {  if (notification.permission !== "granted")  notification.requestpermission();  var notification = window.notification || window.moznotification ||      window.webkitnotification;  notification.requestpermission(function(permission){});   });function notifyme(titleisthi,contentbody,linktoopen) {   if (!notification) {  alert('desktop notifications not available in browser. try chromium.');   return;  }  if (notification.permission !== "granted")  notification.requestpermission();                  else {      var notification = new notification(titleisthi, {   icon: 'avator/small-icon.png',   body: contentbody,   });  notification.onclick = function () {  window.open(linktoopen);        };}}  

the problem code sends many notifications or frequent can there dosent sends more 2 notification within 30 minutes. , users dont need allow browser receive notification or not.

any appreciated. know sending notifications depends on code or calling function wondering if there can prevent them globally.


Comments