扫码关注官方订阅号
如何实现网页qq的跨页面的消息提醒?
光阴似箭催人老,日月如移越少年。
使用的 postMessage ??
html5有个新特性。当有消息是调用这个函数,就可以跨页面消息提示,你可以在控制台测试下Notification.requestPermission(function(status) {
//status是授权状态,如果用户允许显示桌面通知,则status为'granted' console.log('status: ' + status); //permission只读属性 var permission = Notification.permission; //default 用户没有接收或拒绝授权 不能显示通知 //granted 用户接受授权 允许显示通知 //denied 用户拒绝授权 不允许显示通知 console.log('permission: ' + permission); });
new Notification("sir, you got a message", {
body: 'you will have a meeting 5 minutes later.'
});
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
使用的 postMessage ??
html5有个新特性。当有消息是调用这个函数,就可以跨页面消息提示,你可以在控制台测试下
Notification.requestPermission(function(status) {
new Notification("sir, you got a message", {
});