Back to Content

Permissions-Policy: autoplay directive

files/en-us/web/http/reference/headers/permissions-policy/autoplay/index.md

latest1.3 KB
Original Source

{{SeeCompatTable}}

The HTTP {{HTTPHeader("Permissions-Policy")}} header autoplay directive controls whether the current document is allowed to autoplay media requested through the {{domxref("HTMLMediaElement")}} interface.

Specifically, where a defined policy blocks use of this feature and there were no user gestures, the {{jsxref("Promise")}} returned by {{domxref("HTMLMediaElement.play()")}} will reject with a {{domxref("DOMException")}}. The autoplay attribute on {{HTMLElement("audio")}} and {{HTMLElement("video")}} elements will be ignored.

[!NOTE] For more details on autoplay and autoplay blocking, see the article Autoplay guide for media and Web Audio APIs.

Syntax

http
Permissions-Policy: autoplay=<allowlist>;
  • <allowlist>

Default policy

The default allowlist for autoplay is self.

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also