TrustedTypePolicyFactory.defaultPolicy
The defaultPolicy
read-only property of the TrustedTypePolicyFactory
interface returns the default TrustedTypePolicy
or null if this is empty.
Note
Information about the creation and use of default policies can be found in the createPolicy()
documentation.
Syntax
var defaultPolicy = TrustedTypePolicyFactory.defaultPolicy;
Value
A TrustedTypePolicy
or null.
Examples
The first line below returns null as no default policy has been created. Once a default policy is created, calling defaultPolicy
returns that policy object.
console.log(trustedTypes.defaultPolicy); // null
const dp = trustedTypes.createPolicy('default', {});
console.log(trustedTypes.defaultPolicy); // a TrustedTypePolicy object
Specifications
Specification | Status | Comment |
---|---|---|
Trusted Types The definition of 'TrustedTypePolicyFactory.defaultPolicy' in that specification. |
Editor's Draft | Initial definition. |
Browser compatibility
BCD tables only load in the browser