Sanitize
Methods for sanitizing HTML template strings before rendering them into the UI.
sanitize() |
---|
Sanitizes an HTML string by removing malicious and unallowed properties, attributes, and elements. |
Syntax
/** * @param {String} html The raw HTML string * @return {String} The sanitized HTML string */ portal.sanitize(html) |
Example
// Sanitize a string // Returns '<img src="x">' var sanitized = portal.sanitize('<img onerror="alert(\'xss attack\')" src="x">'); |
Copyright © 2022. Cloud Software Group, Inc. All Rights Reserved.