Movatterモバイル変換


[0]ホーム

URL:


  1. 面向开发者的 Web 技术
  2. HTTP
  3. 参考
  4. HTTP 标头
  5. Permissions-Policy
  6. Permissions-Policy: web-share

此页面由社区从英文翻译而来。了解更多并加入 MDN Web Docs 社区。

View in EnglishAlways switch to English

Permissions-Policy: web-share

Limited availability

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

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

HTTPPermissions-Policy 标头的web-share 指令控制当前文档是否允许使用 Web Share API 的Navigator.share() 方法将文本、链接、图像和其他内容分享到用户选择的任意目标。

具体而言,如果定义的策略阻止使用此特性,则调用Navigator.share() 将以NotAllowedError 类型的DOMException 拒绝其返回的Promise

语法

http
Permissions-Policy: web-share=<allowlist>;
<allowlist>

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

默认策略

web-share 的默认允许列表为:self

规范

Specification
Web Share API
# permissions-policy

浏览器兼容性

参见

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2026 Movatter.jp