HTML & DOM Security
Trusted HTML
Create and inspect TrustedHTML policy tokens for secure innerHTML injection.
Checking support...
Feature Not SupportedThis browser does not support the Trusted HTML Web API feature. Try testing in a modern browser (such as Chrome, Edge, Safari, or Firefox).
Advertisement
Interactive Input Workspace
Ready for input
Web API Execution Output
Result output will be displayed here after processing...
Native JavaScript Code Example (Zero Libraries)
const escapePolicy = trustedTypes.createPolicy('myHtmlPolicy', {
createHTML: string => string.replace(/</g, '<')
});About the Trusted HTML Web API
TrustedTypes API enforces creation of TrustedHTML instances prior to DOM mutation.
Specification:W3C & WHATWG Web API Standard
Sponsored Content