ftos.utils.html.sanitize

Sanitizes a string containing HTML code. Removes JavaScript, <style> and <script> tags, inline event handlers (e.g., onclick), and HTML comments.

Syntax

Copy
ftos.utils.html.sanitize(html: string): string
 
Parameter Type Description
html string The HTML code to sanitize, removing elements and attributes that may lead to cross-site scripting (XSS).

Return Value

Returns a string of sanitized HTML code.

IMPORTANT!  
This is a best-effort sanitization only. For full protection against XSS and other injection attacks, it is recommended to use a dedicated third-party dedicated security service or app.

Example