我想送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