我想送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发送通知。我没有找到任何代码请帮助我。请任何人帮助我。
请不要多次提问相同的问题(例如http://stackoverflow.com/questions/37074078/how-to-send-notification-to-particular-firefox-web-browser)。 – duskwuff