PermissionsPolicy Class

The policy object of a document or of an iframe element (https://w3c.github.io/webappsec-permissions-policy/#the-policy-object, document.permissionsPolicy and iframe.permissionsPolicy): the introspection of the permissions policy of the document, or of the policy that a document loaded into the iframe would inherit.

public sealed class PermissionsPolicy

Methods

NameDescription
AllowedFeatures()Returns the tokens of the features allowed by the policy for the origin of the document, or for the declared origin of the iframe (https://w3c.github.io/webappsec-permissions-policy/#dom-permissionspolicy-allowedfeatures).
AllowsFeature(string, string?)Returns whether a feature is allowed by the policy for an origin (https://w3c.github.io/webappsec-permissions-policy/#dom-permissionspolicy-allowsfeature).
Features()Returns the tokens of the supported features (https://w3c.github.io/webappsec-permissions-policy/#dom-permissionspolicy-features).
GetAllowlistForFeature(string)Returns the allowlist of a feature (https://w3c.github.io/webappsec-permissions-policy/#dom-permissionspolicy-getallowlistforfeature): *, or the serialization of the origins and the source expressions of the declared policy of the document (of the allow attribute of the iframe). It is empty when the feature is not allowed. A feature that is not declared has its default allowlist: *, or the origin of the document (the declared origin of the iframe).

AllowedFeatures()

PermissionsPolicy.cs

Returns the tokens of the features allowed by the policy for the origin of the document, or for the declared origin of the iframe (https://w3c.github.io/webappsec-permissions-policy/#dom-permissionspolicy-allowedfeatures).

public IReadOnlyList<string> AllowedFeatures()

AllowsFeature(string, string?)

PermissionsPolicy.cs

Returns whether a feature is allowed by the policy for an origin (https://w3c.github.io/webappsec-permissions-policy/#dom-permissionspolicy-allowsfeature).

public bool AllowsFeature(string feature, string? origin = null)

Parameters

feature string
The token of the feature (e.g. fullscreen).
origin string?
The serialization of an origin, or null for the origin of the document (the declared origin of the iframe).

Returns

bool

See also

Returns the tokens of the supported features (https://w3c.github.io/webappsec-permissions-policy/#dom-permissionspolicy-features).

public IReadOnlyList<string> Features()

GetAllowlistForFeature(string)

PermissionsPolicy.cs

Returns the allowlist of a feature (https://w3c.github.io/webappsec-permissions-policy/#dom-permissionspolicy-getallowlistforfeature): *, or the serialization of the origins and the source expressions of the declared policy of the document (of the allow attribute of the iframe). It is empty when the feature is not allowed. A feature that is not declared has its default allowlist: *, or the origin of the document (the declared origin of the iframe).

public IReadOnlyList<string> GetAllowlistForFeature(string feature)