stack

Home > @infiniteobjects/core-library-web > Html > sanitize

Html.sanitize() method

Sanitize html string

Signature:

static sanitize(html: string, makeLinksExternal?: boolean): string;

Parameters

Parameter Type Description
html string HTML string to sanitize
makeLinksExternal boolean (Optional) Make all non relative links in html string open in a new tab

Returns:

string

Remarks

Will strip out everything that contains dangerous HTML and thereby prevent XSS attacks and other nastiness.