如何发送到pushnotifications Firefox Web浏览器? [英] how to send pushnotifications to firefox web browser?

查看:381
本文介绍了如何发送到pushnotifications Firefox Web浏览器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想送pushnotifications到Firefox Web浏览器.......

I want to send pushnotifications to firefox web browser.......

<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>

第一次的时候我的网站运行许可弹出窗口将come.but当用户点击允许按钮如何让浏览器的信息像id.I要保存浏览器ID到我database.next时间,我将使用该ID发送通知。我没有找到任何code,请帮助me.please任何人帮助我​​。

whenever first time my website run permission popup will come.but when user click allow button how to get browser info like id.I want save that browser id into my database.next time I will send notification using that id. I did not find any code please help me.please anyone help me.

推荐答案

借助的Web API的通知不就什么认为它。

它只能用于显示从网页,用户目前在他们的浏览器中打开的通知。这相当于把警报(),除了具有较大的多种格式选项。

It can only be used to display notifications from a web page that a user currently has open in their browser. It is comparable to alert(), except with a larger variety of formatting options.

不会推送通知服务,不能用于为一体。

It is not a push notification service, and cannot be used as one.

这篇关于如何发送到pushnotifications Firefox Web浏览器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆