Comments (11)
@liujinge file:// 文件协议是没有通知的。
from blog.
新版Chrome61好像无效啊
Notification.requestPermission().then(function (permission) {
if (permission === 'granted') {
console.log(Notification)
var n = new Notification('状态更新提醒',{
body: '你的朋友圈有3条新状态,快去查看吧',
tag: 'linxin',
icon: 'http://blog.gdfengshuo.com/images/avatar.jpg',
data: {
url: 'http://blog.gdfengshuo.com'
},
requireInteraction: true
})
console.log(n)
/*setTimeout(function () {
n.close()
}, 3000)*/
}
})
from blog.
@18664363461 我用 60 的有效啊,61居然没效,我试试。
from blog.
用的Google 60,为什么没有通知呢?
Notification.requestPermission().then(function(permission) { if(permission === 'granted'){ console.log('用户允许通知'); }else if(permission === 'denied'){ console.log('用户拒绝通知'); } });
var notification = new Notification('状态更新提醒',{ body: '你的朋友圈有3条新状态,快去查看吧', tag: 'linxin', icon: 'http://blog.gdfengshuo.com/images/avatar.jpg', requireInteraction: true })
from blog.
浏览器设置里面消息通知是否允许了呢?我用的windows Chrome61是无效,FireFox是可以的。
from blog.
@18664363461 你的是不是也是直接双击打开的呢?还是有用服务器打开的
from blog.
直接本地写的demo(双击打开),如果要本地服务打开好像Chrome要https才可以
from blog.
@18664363461 那确实不行。不用https,用 http://localhost 都可以
from blog.
可以了 api没问题了,我在https网页console测试了可以的。好的 localhost我试试!谢谢啊
from blog.
from blog.
我看到ins和哔哩哔哩,明明没有打开他们的网站,但是还是收到了桌面通知,是可以服务端推送吗?
from blog.
Related Issues (20)
- Electron 实战桌面计算器应用 HOT 2
- Parcel:常见技术栈的集成方式 HOT 1
- Node.js 应用:Koa2 之文件上传下载 HOT 7
- React Native组件集成到Android原生项目 HOT 2
- 使用 Node.js 开发简单的脚手架工具 HOT 16
- Node.js 应用:Koa2 使用 JWT 进行鉴权 HOT 18
- 请教一下
- vue-manage-system 后台管理系统开发总结 HOT 2
- bind()实现中的 [].concat.call(args, [].slice.call(arguments) HOT 3
- 求博客主体模板 HOT 2
- 作者你好!H5 drop event
- element ui upload怎样修改缩略图路径
- indexedDB结合vuex store使用 HOT 1
- Rollup.js: 开源JS库的打包利器
- 前端常见的加密算法介绍 HOT 1
- file-demo 拍照,xs max照片旋转 HOT 2
- Vue3 插件开发详解尝鲜版
- vue项目中实现Excel文件的上传和下载
- vue3 + tsrpc +mongodb 实现后台管理系统 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from blog.