< >

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>
  var title ="Dein Titel und er kann auch sehr laaaaaaaang sein. ";
var len = title.length;
var position = 0;
scrolltitle();
function scrolltitle() {
    rese=setTimeout(function(){ scrolltitle()},200);
    document.title = title.substring(position, len) + title.substring(0, position);
    position++;
    if (position > len) position = 0;
   
}

  function notifyMe() {
 
  // Let's check if the browser supports notifications
  if (!("Notification" in window)) {
    alert("This browser does not support desktop notification");
  }

  // Let's check whether notification permissions have alredy been granted
  else if (Notification.permission === "granted") {
    // If it's okay let's create a notification
        alert('erlaubt')
    var notification = new Notification("Hi there!");
  }

  // Otherwise, we need to ask the user for permission
  else if (Notification.permission !== 'denied') {
  alert('abgelehnt')
    Notification.requestPermission(function (permission) {
      // If the user accepts, let's create a notification
      if (permission === "granted") {
      alert('akzeptiert')
        var notification = new Notification("Hi there!");
      }
    });
  }
 
}
  
</script>

Add Comment

* Required information
1000
Powered by Commentics

Comments (1)

Gravatar
Admin
Sascha65says...

Die Canvas Balken Uhr ist ja mal Fett