Encodes a given string for safe output in the specified context. The encoding is meant to mitigate Cross Site Scripting (XSS) attacks.
encodeFor(type, value)
returns string
Name | Type | Required | Default | Description |
---|---|---|---|---|
type | string | Yes | The context of the encoding to perform. | |
value | string | Yes | The value to encode. |
Pass in a tag and HTML encode the result.
encodeFor("html","<br>")