Permissions-Policy: bluetooth

Limited availability

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

实验性: 这是一项实验性技术
在将其用于生产之前,请仔细检查浏览器兼容性表格

HTTP Permissions-Policy 标头的 bluetooth 指令控制当前文档是否被允许使用 Web Bluetooth API

具体来说,如果定义的策略不允许使用此特性,则由 Navigator.bluetooth 返回的 Bluetooth 对象的方法将会阻止访问:

语法

http
Permissions-Policy: bluetooth=;

允许使用该特性的来源列表。请参阅 Permissions-Policy > 语法了解更多详细信息。

默认策略

bluetooth 的默认允许列表为:self

示例

通用示例

SecureCorp Inc. 希望在所有浏览上下文中禁用 Web Bluetooth API,除了其自身的来源和来源 https://example.com。它可以通过发送以下 HTTP 响应标头来定义权限策略:

http
Permissions-Policy: bluetooth=(self "https://example.com")

带有