Notification:maxActions 静态属性

Limited availability

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

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

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

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

Notification 接口的 maxActions 只读静态属性返回设备和用户代理支持的最大操作的数量。实际上,这是会被用户代理遵守的 Notification.actions 数组中的元素的最大数量。

一个表示用户代理和设备可以向用户呈现的通知操作的最大数量的整数。

示例

以下代码片段打印了支持的操作的最大数量。

js
const maxActions = Notification.maxActions;
console.log(`此设备最多可以对每个通知显示 ${maxActions} 个操作。`);

规范

Specification
Notifications API
# dom-notification-maxactions

浏览器兼容性

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
maxActions static property
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.

参见