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

浏览器兼容性

另见