Chrome Extension notifications【谷歌浏览器扩展之弹窗通知】
来源:互联网 发布:淘宝上的小样是真是假? 编辑:程序博客网 时间:2024/05/29 17:30
起初为方便快速使用的是 alert ,后优化时发现并使用 notifications API 来代替。
使用 chrome.notifications API 须先配置 manifest 文件中的 permissions :
"permissions": ["notifications","downloads","storage"]
调用示例:
chrome.notifications.getPermissionLevel(function(level){//获取用户是否为当前应用或应用启用通知(permissions中已配置可直接调用notifications)if( level == 'granted' ){//发出通知, type 默认为 basicchrome.notifications.create('notify_alert1', // notifyId{type: "basic", iconUrl: "icon-48.png", title: "更新完成!", message: "请查看页面数据是否已更新。"}, function(notifyId){//不用移除该消息,否者不会显示// chrome.notifications.clear(notifyId, function(){ });});}else{//...alert('更新完成!')}});
阅读全文
0 0
- Chrome Extension notifications【谷歌浏览器扩展之弹窗通知】
- Chrome Extension manifest【谷歌浏览器扩展之配置】
- Chrome notifications -- Chrome 浏览器消息通知中心
- Chrome Extension sendMessage & sendRequest【谷歌浏览器扩展之消息通信】
- Chrome Extension options_page & storage【谷歌浏览器扩展之选项页和storage】
- Chrome Extension Ajax & downloads【谷歌浏览器扩展之Ajax和下载】
- chrome浏览器的桌面通知规范desktop notifications
- Chrome浏览器扩展开发系列之十:桌面通知Notification
- chrome 桌面通知 Notifications 用法
- 浏览器桌面通知(notifications)
- Chrome 浏览器 extension 指南
- Chrome浏览器扩展学习之 - 添加书签
- 谷歌浏览器插件 离线安装 AXURE RP EXTENSION For Chrome
- 下载谷歌浏览器(Chrome)扩展crx文件
- chrome 谷歌浏览器怎么添加Axure扩展
- 通知(Notifications)
- Notifications 通知
- Chrome浏览器扩展开发系列之十九:扩展开发示例
- python基础知识——数组拼接(以iris数据为例……)
- AOP--Aspect Oriented Programming
- 1006. 换个格式输出整数 (15)用时9min一次通过
- Bootstrap 模态框(Modal)插件
- 接入sdk 采用aar jar 插件方式踩坑
- Chrome Extension notifications【谷歌浏览器扩展之弹窗通知】
- CTF web题总结--LFI
- static与extern
- 分享一个我的android红白机
- Java中集合Set的用法
- Python3《机器学习实战》学习笔记(六):Logistic回归基础篇之梯度上升算法
- Ubuntu10下Apache-2.2安装
- JDK源码解析集合篇--综述
- 物联网NB-IoT与LoRa技术对比