2016-05-06 126 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

请任何人帮助我。 –

相关问题