【发布时间】:2015-07-31 16:30:14
【问题描述】:
我想知道 Web Push 背后有哪些技术,例如https://goroost.com
它是如何工作的?如何为 Web Push 配置我的服务器?我应该看什么?
【问题讨论】:
标签: web notifications web-push push-api
我想知道 Web Push 背后有哪些技术,例如https://goroost.com
它是如何工作的?如何为 Web Push 配置我的服务器?我应该看什么?
【问题讨论】:
标签: web notifications web-push push-api
我可以回答WonderPush.com
首先,您需要在 WonderPush 上注册并声明您的网站。
然后,在结束<body>标签之前复制/粘贴以下sn-p:
<script>
(function(w, d, s, id, n){
w[n] = w[n] || {q: [],
init: function(o) {w[n].initOpts = o;},
ready: function(c) {w[n].q.push(c);}};
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {return;}
js = d.createElement(s); js.id = id;
js.src = "https://cdn.by.wonderpush.com/sdk/1.1/wonderpush-loader.min.js";
fjs.parentNode.insertBefore(js, fjs);
}(window, document, 'script', 'wonderpush-jssdk-loader','WonderPush'));
WonderPush.init({
webKey: "[YOUR_WEBKEY]" // sign up for FREE to retrieve your web key
});
</script>
【讨论】:
底层技术是Push API,结合Notifications API
您可以在Google's developer docs 中阅读有关如何自己实现此功能的更多信息。请注意,目前只有 Google Chrome 支持推送通知,但微软和Mozilla 表示他们将很快实施。
【讨论】: