Push.js是基于Notification API实现的桌面效果的提示栏。浏览器支持情况见 http://caniuse.com/#search=Notification
具体文档见:
Github:https://github.com/Nickersoft/push.js
官网:http://nickersoft.github.io/push.js
查看简单效果请点击阅读全文。
<button id="push_test" class="btn success">点击我查看效果,需要获取通知权限。</button>
<script src="https://laji.blog/js/push.min.js"></script>
<script>
document.getElementById('push_test').onclick = function () {
Push.create("暴力膜蛤不可取!",{
body:'识得唔识得啊?', icon:'https://laji.blog/img/moha.png',
timeout:4000,
onClick:function () {
window.focus();
this.close();
}
});
}
</script>
<script src="push.min.js"></script>
<script>
document.getElementById('pust_test').onclick = function () {
Push.create("暴力膜蛤不可取!",{
body:'识得唔识得啊?',
icon:'moha.png',
timeout:4000,
onClick:function () {
window.focus();
this.close();
}
});
}
</script>
Comments | NOTHING