HtmlSanitizer

screenshot of HtmlSanitizer

Fast JavaScript HTML Sanitizer, client-side (i.e. needs a browser, won't work in Node and other backend)

Overview

The JS Html Sanitizer is a client-side HTML Sanitizer designed to prevent XSS attacks and unwanted tags in user-generated content. It is fast, lightweight, and does not have any dependencies, making it a reliable tool to enhance web security. Note that server-side input sanitization is still essential for complete protection against XSS attacks.

Features

  • Very fast with the ability to handle 8000 operations per second.
  • Compact size of only 1.7kb unminified.
  • Zero dependencies, written in vanilla JavaScript, compatible even with IE.
  • Whitelisting approach for comprehensive cleaning of disallowed elements.