Notification: title 屬性

可用性有限

此特性不是基線特性,因為它在一些最廣泛使用的瀏覽器中不起作用。

安全上下文: 此功能僅在安全上下文(HTTPS)中可用,且支援此功能的瀏覽器數量有限。

注意:此功能在 Web Workers 中可用。

titleNotification 介面的一個只讀屬性,它指示通知的標題,該標題是在 Notification() 建構函式的 title 引數中指定的。

字串。

示例

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

  const n = new Notification(theTitle, options);

  console.log(n.title);
}

規範

規範
Notifications API
# dom-notification-title

瀏覽器相容性

另見