Notification 的只读属性body返回了构造函数Notification实例化时,options所使用的body值。
Note: 此特性在 Web Worker 中可用。
语法
var body = Notification.body;
值
示例
在 Emogotchi demo (see source code)中, 我们在激活一个桌面通知时,调用了spawnNotification()函数—函数被传入了指定的参数 body、icon、title , 创建了一个必选对象传入Notification() 构造函数创建了一个实例.
function spawnNotification(theBody,theIcon,theTitle) {
var options = {
body: theBody,
icon: theIcon
}
var n = new Notification(theTitle,options);
}
规范
| Specification | Status | Comment |
|---|---|---|
| Notifications API body |
Living Standard | Living standard |
浏览器兼容性
| Feature | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari |
|---|---|---|---|---|---|---|
| Basic support | 5 webkit (see notes) 22 |
(Yes) | 4.0 moz (see notes) 22 |
未实现 | 25 | 6 (see notes) |
| Available in workers | ? | ? | 41.0 (41.0) | ? | ? | ? |
| Feature | Android | Android Webview | Edge | Firefox Mobile (Gecko) | Firefox OS | IE Mobile | Opera Mobile | Safari Mobile | Chrome for Android |
|---|---|---|---|---|---|---|---|---|---|
| Basic support | ? |
(Yes) |
(Yes) | 4.0 moz (see notes) 22 |
1.0.1 moz (see notes) 1.2 |
未实现 | ? | 未实现 |
(Yes) |
| Available in workers | ? | ? | ? | 41.0 (41.0) | ? | ? | ? | ? | ? |