TrustedTypePolicyFactory Class
https://w3c.github.io/trusted-types/dist/spec/#trusted-type-policy-factory: the trusted type policy factory of a global object (Window.TrustedTypes, WorkerGlobalScope.TrustedTypes). A document without a window (e.g. a document parsed without a browsing context) is its own global object: see Document.TrustedTypes.
public sealed class TrustedTypePolicyFactoryProperties
| Name | Description |
|---|---|
| DefaultPolicy | https://w3c.github.io/trusted-types/dist/spec/#dom-trustedtypepolicyfactory-defaultpolicy |
| EmptyHtml | https://w3c.github.io/trusted-types/dist/spec/#dom-trustedtypepolicyfactory-emptyhtml |
| EmptyScript | https://w3c.github.io/trusted-types/dist/spec/#dom-trustedtypepolicyfactory-emptyscript |
DefaultPolicy
TrustedTypePolicyFactory.cshttps://w3c.github.io/trusted-types/dist/spec/#dom-trustedtypepolicyfactory-defaultpolicy
public TrustedTypePolicy? DefaultPolicy { get; }EmptyHtml
TrustedTypePolicyFactory.cshttps://w3c.github.io/trusted-types/dist/spec/#dom-trustedtypepolicyfactory-emptyhtml
public TrustedHtml EmptyHtml { get; }EmptyScript
TrustedTypePolicyFactory.cshttps://w3c.github.io/trusted-types/dist/spec/#dom-trustedtypepolicyfactory-emptyscript
public TrustedScript EmptyScript { get; }Methods
| Name | Description |
|---|---|
| CreatePolicy(string, TrustedTypePolicyOptions?) | https://w3c.github.io/trusted-types/dist/spec/#dom-trustedtypepolicyfactory-createpolicy |
| GetAttributeType(string, string, string?, string?) | https://w3c.github.io/trusted-types/dist/spec/#dom-trustedtypepolicyfactory-getattributetype: the name of the trusted type required by a content attribute ("TrustedHTML", "TrustedScript" or "TrustedScriptURL"), or null. |
| GetPropertyType(string, string, string?) | https://w3c.github.io/trusted-types/dist/spec/#dom-trustedtypepolicyfactory-getpropertytype: the name of the trusted type required by an IDL attribute of an element ("TrustedHTML", "TrustedScript" or "TrustedScriptURL"), or null. |
| IsHtml(object?) | https://w3c.github.io/trusted-types/dist/spec/#dom-trustedtypepolicyfactory-ishtml |
| IsScript(object?) | https://w3c.github.io/trusted-types/dist/spec/#dom-trustedtypepolicyfactory-isscript |
| IsScriptUrl(object?) | https://w3c.github.io/trusted-types/dist/spec/#dom-trustedtypepolicyfactory-isscripturl |
CreatePolicy(string, TrustedTypePolicyOptions?)
TrustedTypePolicyFactory.cshttps://w3c.github.io/trusted-types/dist/spec/#dom-trustedtypepolicyfactory-createpolicy
public TrustedTypePolicy CreatePolicy(string policyName, TrustedTypePolicyOptions? policyOptions = null)Parameters
policyNamestringpolicyOptionsTrustedTypePolicyOptions?
Returns
Exceptions
TypeErrorException- The creation of the policy is blocked by
Document.TrustedTypesDirectives, or a default policy already exists.
See also
GetAttributeType(string, string, string?, string?)
TrustedTypePolicyFactory.cshttps://w3c.github.io/trusted-types/dist/spec/#dom-trustedtypepolicyfactory-getattributetype: the name of the trusted type required by a content attribute ("TrustedHTML", "TrustedScript" or "TrustedScriptURL"), or null.
GetPropertyType(string, string, string?)
TrustedTypePolicyFactory.cshttps://w3c.github.io/trusted-types/dist/spec/#dom-trustedtypepolicyfactory-getpropertytype: the name of the trusted type required by an IDL attribute of an element ("TrustedHTML", "TrustedScript" or "TrustedScriptURL"), or null.
Parameters
Returns
See also
IsHtml(object?)
TrustedTypePolicyFactory.cshttps://w3c.github.io/trusted-types/dist/spec/#dom-trustedtypepolicyfactory-ishtml
IsScript(object?)
TrustedTypePolicyFactory.cshttps://w3c.github.io/trusted-types/dist/spec/#dom-trustedtypepolicyfactory-isscript
IsScriptUrl(object?)
TrustedTypePolicyFactory.cshttps://w3c.github.io/trusted-types/dist/spec/#dom-trustedtypepolicyfactory-isscripturl