W3cubDocs

/Web APIs

TrustedTypePolicy: name property

The name read-only property of the TrustedTypePolicy interface returns the name of the policy.

Value

A string containing the name of the policy.

Examples

In the below example a policy called myEscapePolicy is created using TrustedTypePolicyFactory.createPolicy() and is represented by the object escapeHTMLPolicy. Calling name on this object returns the string "myEscapePolicy".

js

const escapeHTMLPolicy = trustedTypes.createPolicy("myEscapePolicy", {
  createHTML: (string) => string.replace(/>/g, "<"),
});

console.log(escapeHTMLPolicy.name); /* "myEscapePolicy" */

Specifications

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
name 83 83 No No 69 No 83 83 No 59 No 13.0

© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicy/name