TrustedTypePolicyFactory: defaultPolicy property
Trusted Types API
Trusted Types API
The **`defaultPolicy`** read-only property of the TrustedTypePolicyFactory interface returns the default TrustedTypePolicy or null if this is empty.
See [The default policy](/docs/Web/API/Trusted_Types_API#the_default_policy) for more details.
## 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
## Browser compatibility
Cite this
"TrustedTypePolicyFactory: defaultPolicy property". MDN Web Docs. CC BY-SA 2.5 (MDN). https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicyFactory/defaultPolicy JSON record · API collection · BibTeX · RIS · CSL-JSON · citation policy