Navigator: presentation 屬性

可用性有限

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

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

Navigator 的只讀屬性 presentationPresentation API 的入口點,它返回一個指向 Presentation 物件的引用。

指向 Presentation 物件的引用。

示例

當前,navigator.presentation 屬性對於功能檢查非常有用,並且對於接收使用者代理來說,可以訪問 PresentationReceiver

js
// Check if the Presentation API is available in the current browser
if ("presentation" in navigator) {
  footer.textContent = navigator.presentation.receiver
    ? "Receiving presentation"
    : "(idle)";
} else {
  console.error("Presentation API is not available in this browser.");
}

規範

規範
Presentation API
# dom-navigator-presentation

瀏覽器相容性

另見