Ne arayalım?

ARAMIZA KATILIN

BİZE ULAŞIN

Adres:

E-posta:

host/bin/bilisimlife.dll

iletisim@bilisimlife.net




 
Rserit
Developer
       
 1026  
 278

Google Chrome Desktop Notification

Selamlar,

Chrome kullanıp Facebook gibi yerlerden bildirim alabiliyorsunuz. JS ile bir örnek vererek nasıl yapılabileceğini gösterebiliriz. Stackoverflow'da bir örnek görmüştüm.

Kod örneği:


// request permission on page load
document.addEventListener('DOMContentLoaded', function () {
  if (Notification.permission !== "granted")
    Notification.requestPermission();
});

function notifyMe() {
  if (!Notification) {
    alert('Desktop notifications not available in your browser. Try Chromium.'); 
    return;
  }

  if (Notification.permission !== "granted")
    Notification.requestPermission();
  else {
    var notification = new Notification('Notification title', {
      icon: 'http://cdn.sstatic.net/stackexchange/img/logos/so/so-icon.png',
      body: "Hey there! You've been notified!",
    });

    notification.onclick = function () {
      window.open("http://stackoverflow.com/a/13328397/1269037");      
    };

  }

}
<button onclick="notifyMe()">Notify me!</button>


Chrome geliştiricileri için bir uygulama da bulunuyor.

Iyi çalışmalar,

Recep.

Developer.