notification.php


Quell Code


<!-- Learn about this code on MDN: https://developer.mozilla.org/de/docs/Web/API/notification -->

<button onclick="notifyMe()">Notify me!</button>
<script>
  Notification.requestPermission().then(function(result) {
  //console.log(result);
});

Notification.requestPermission();

function notifyMe() {

  if (!("Notification" in window)) {
console.log("This browser does not support system notifications");
  } else if (Notification.permission === "granted") {
    console.log('is ok')
    var notification = new Notification("Hi there!");
  }else if (Notification.permission !== 'denied') {
    Notification.requestPermission(function (permission) {
     console.log('user hat aktzeptiert')
      if (permission === "granted") {
        var notification = new Notification("Hi there!");
      }
    });
  }else{
    console.log('irgendwaserror')
  }

  // Finally, if the user has denied notifications and you 
  // want to be respectful there is no need to bother them any more.
}
notifyMe()
</script>


Deprecated: Directive 'allow_url_include' is deprecated in Unknown on line 0