2016-05-06 176 views
0

我想送pushnotifications到Firefox Web瀏覽器.......如何發送pushnotifications到Firefox瀏覽器?

<script> 
     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 already been granted 
      else if (Notification.permission === "granted") { 
       // If it's okay let's create a notification 
       var notification = new Notification("Hi there!"); 


      } 

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

      // At last, if the user has denied notifications, and you 
      // want to be respectful there is no need to bother them any more. 
     } Notification.requestPermission().then(function (result) { 
      console.log(result); 
     }); function spawnNotification(theBody, theIcon, theTitle) { 
      var options = { 
       body: theBody, 
       icon: theIcon 
      } 
      var n = new Notification(theTitle, options); 
     } 

    </script> 

第一每當時候,用戶點擊允許按鈕如何得到這樣的ID瀏覽器信息我的網站上行駛許可彈出窗口將come.but。我想將該瀏覽器ID保存到我的database.next時間,我將使用該ID發送通知。我沒有找到任何代碼請幫助我。請任何人幫助我。

+0

請不要多次提問相同的問題(例如http://stackoverflow.com/questions/37074078/how-to-send-notification-to-particular-firefox-web-browser)。 – duskwuff

回答

0

Web Notifications API沒有做它認爲的事情。

它只能用於顯示用戶當前在其瀏覽器中打開的網頁的通知。它與alert()相當,但有更多種格式選項。

這是不是推送通知服務,不能作爲一個使用。

+0

感謝您的回覆 –

+0

請幫我。提供任何鏈接。 –

+0

請任何人幫助我。 –

相關問題