TrustedTypePolicyFactory: defaultPolicy property
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Note: This feature is available in Web Workers.
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.
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.
js
console.log(trustedTypes.defaultPolicy); // null
const dp = trustedTypes.createPolicy("default", {});
console.log(trustedTypes.defaultPolicy); // a TrustedTypePolicy object
Specifications
Specification |
---|
Trusted Types # dom-trustedtypepolicyfactory-defaultpolicy |
Browser compatibility
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
defaultPolicy |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- No support
- No support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.