Skip to end of banner
Go to start of banner

escapeHtml

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 7 Current »

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

Return Type

String

Returns the html input escaped.

Example

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

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

See also

  • No labels