Not TestedTesting not done, may not work properly
HTML & DOM Security

Trusted HTML

Create and inspect TrustedHTML policy tokens for secure innerHTML injection.

Checking support...
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, '&lt;')
});

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