Notification:renotify 属性

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

安全上下文: 此项功能仅在一些支持的浏览器安全上下文(HTTPS)中可用。

实验性: 这是一项实验性技术
在将其用于生产之前,请仔细检查浏览器兼容性表格

备注: 此特性在 Web Worker 中可用。

Notification 接口的 renotify 只读属性指定在新通知替换旧通知后是否应当通知用户,在 Notification() 构造函数的 renotify 选项中指定。

一个布尔值。默认值为 false;设为 true 将会使通知重新通知用户。

示例

以下代码片段用于在一个通知被替换以后触发重新向用户发送通知;它创建一个简单的 options 对象,然后调用 Notification() 构造函数触发通知。

js
const options = {
  body: "你提交的代码收到了 3 条新的审阅意见。",
  renotify: true,
};

const n = new Notification("新评论活动", options);

console.log(n.renotify); // true

规范

Specification
Notifications API
# dom-notification-renotify

浏览器兼容性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
renotify
Experimental

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support
Experimental. Expect behavior to change in the future.
See implementation notes.

参见