{"id":13670262,"url":"https://github.com/rentiansheng/notification","last_synced_at":"2025-12-30T01:05:51.498Z","repository":{"id":16479815,"uuid":"19232192","full_name":"rentiansheng/notification","owner":"rentiansheng","description":"浏览器桌面通知","archived":false,"fork":false,"pushed_at":"2024-02-26T07:40:42.000Z","size":23,"stargazers_count":50,"open_issues_count":0,"forks_count":22,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-08-03T09:07:18.101Z","etag":null,"topics":["chrome","javascript","notifications"],"latest_commit_sha":null,"homepage":null,"language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rentiansheng.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-04-28T08:38:29.000Z","updated_at":"2024-02-23T07:26:26.000Z","dependencies_parsed_at":"2022-09-24T12:03:30.985Z","dependency_job_id":null,"html_url":"https://github.com/rentiansheng/notification","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rentiansheng%2Fnotification","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rentiansheng%2Fnotification/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rentiansheng%2Fnotification/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rentiansheng%2Fnotification/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rentiansheng","download_url":"https://codeload.github.com/rentiansheng/notification/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224067054,"owners_count":17250103,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chrome","javascript","notifications"],"created_at":"2024-08-02T09:00:37.135Z","updated_at":"2025-12-30T01:05:51.472Z","avatar_url":"https://github.com/rentiansheng.png","language":"HTML","funding_links":[],"categories":["HTML"],"sub_categories":[],"readme":"[English documentation](README_EN.md)\n## chrome 浏览器桌面通知\n\n##\n\n## 简介\n\n用于其余B/S下的网络办公提醒功能。\n页面最小化的状态下发送通知\n依然显示在屏幕的右下角，马上可以看到内容\n\n## 依赖\n\n1. PC chrome浏览器。\n2. 手机android 海豚浏览器\n3. firefox 可用但是智能展示一个通知（不建议使用，不同版本存在差异）\n\n\n## 注意事项\n\n#### 1. 关于权限\n通知权限是基于网站（或者域名），同一个网站下面的页面只需要获取一次权限即可。\n如果在同一个域名下别的页面中禁用。将不会显示通知的，也无法再次获取权限了。\n可以同浏览器的菜单查看权限。 \n```HTML\n设置-》隐私设选下面的 “内容设置”-》通知\n```\n如果你关闭或者刷新页面了。之前的通知就没法控制了 。\n\n#### 2. 测试相关\n\n直接在浏览器中直接打开测试页面，无法发送通知，请使用http 请求访问页面。\n\n\n\n## 使用\n\n1. 引用notify.js文件\n\n```HTML\n    \u003cscript src=\"notifiy.js\"\u003e\u003c/script\u003e\n```\n\n2. 浏览器配置,检查浏览器是否支持桌面通知功能\n```HTML\n    Notifier.HasSupport();\n```\n\n3. 获取允许桌面通知权限\n```HTML\n    Notifier.RequestPermission();\n```\n\n\n4. 设置通知显示方式（可选。不设置采用默认模式）\n    \n```HTML\n     Notifier.ModelAll();       //默认方式，显示所有的。在linux一般为三个。在window显示在通知区域。\n\n     Notifier.ModelUpdate();    //更新模式，显示在上一个通知的位置，\n\n     Notifier.ModelCount(c);    //限制当前页面显示的通知个数，默认为三个(可以通过参数c改变个数)。超出限制时关闭最早的通知，\n\n     Notifier.ModelTimeout(ct); //超时消失模式。显示一定时间自动消失。\n```\n\n5. 发送通知\n\n```HTML\n    Notifier.Notify(icon, title, message); //显示桌面通知，icon：图片的地址  title:通知的标题 message：通知的内容\n    Notifier.Notify(icon, title, message, fnClick); //显示桌面通知，icon：图片的地址  title:通知的标题 message：通知的内容 fnClick: 单机事件函数\n```\n\n6. 关闭的方法\n    \n```HTML\n     Notifier.Close(type);    //type=1 关闭上一个 其他值 关闭最早打开的\n\n     Notifier.ClosePre();    //关闭最近个打开的通知\n\n     Notifier.CloseLast();   //关闭最早显示的通知\n\n     Notifier.CloseAll();    //关闭所有通知\n```\n\n7. 其他方法\n    \n```HTML\n    Notifier.GetPermission();   //获取关于通知使用权限，0，已经得到权限 1，需要获取权限 2，禁止使用\n\n    Notifier.IsGetPermission(); //是否已经获取通知的使用权限\n\n    Notifier.Disable();         //是否禁用通知\n```\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frentiansheng%2Fnotification","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frentiansheng%2Fnotification","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frentiansheng%2Fnotification/lists"}