Notification: thuộc tính body

Limited availability

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

Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.

Note: This feature is available in Web Workers.

Thuộc tính chỉ đọc body của giao diện Notification cho biết chuỗi nội dung của thông báo, như được chỉ định trong tùy chọn body của constructor Notification().

Giá trị

Một chuỗi.

Ví dụ

js
function spawnNotification(theBody, theIcon, theTitle) {
  const options = {
    body: theBody,
    icon: theIcon,
  };
  const n = new Notification(theTitle, options);

  console.log(n.body);
}

Thông số kỹ thuật

Specification
Notifications API
# dom-notification-body

Tương thích trình duyệt

Xem thêm