escapeHtml

Looking for the documentation on the newest versions of SIL Engine and the Simple Issue Language for Jira 8 for Server/Data Center?Ā Click hereĀ !

Syntax

escapeHtml(html)

Description

Escapes the given html removing traces of offending characters that could be wrongfully interpreted as markup.

The following characters are reserved in HTML and must be replaced with their corresponding HTML entities:

  • "Ā is replaced withĀ "

  • &Ā is replaced withĀ &

  • <Ā is replaced withĀ &lt;

  • >Ā is replaced withĀ &gt;

Parameters

Parameter name

Type

Required

Description

Parameter name

Type

Required

Description

html

string

Yes

HTML to escape

Return type

String

Returns the html input escaped.

Example

return escapeHtml("<html><script><img src=1 onerror=alert(1)></script></html>");

Returns "&lt;html&gt;&lt;script&gt;&lt;img src=1 onerror=alert(1)&gt;&lt;/script&gt;&lt;/html&gt;"

See also