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 emptyHTML read-only property of the TrustedTypePolicyFactory interface returns a TrustedHTML object containing an empty string.
This object can be used when the application requires an empty string to be inserted into an injection sink.
A TrustedHTML object.
In the below example an empty string is to be inserted into the element. Therefore there is no need to create a policy, and the emptyHTML property can be used to insert the empty element when a Trusted Types object is expected.
el.innerHTML = trustedTypes.emptyHTML;
| Specification |
|---|
| Trusted Types> # dom-trustedtypepolicyfactory-emptyhtml> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
emptyHTML |
83 | 83 | No | 69 | 26 | 83 | No | 59 | 26 | 13.0 | 83 | 26 |
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicyFactory/emptyHTML