Get started with sanitize-html CDN
MIT licensed
Sanitize-HTML library converts untrusted HTML to safe, XSS-risk-minimized output format.
Tags:- html
- parser
- sanitizer
- apostrophecms
Stable version
Copied!
How to start using sanitize-html CDN
<!DOCTYPE html>
<html>
<head>
<title>Get started with sanitize-html CDN - cdnhub.io</title>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/sanitize-html.min.js"></script>
</head>
<body>
<script>
const dirtyHtml = '<script src="malicious-script.js"></script><p>Hello, World!</p>';
const sanitizer = new DOMParser().parseFromString('<html></html>'.toString(), 'text/html').createDocumentFragment();
const cleanHtml = sanitizeHtml(dirtyHtml, {
allowedClasses: [],
allowedTags: ['p'],
allowedAttributes: {}
}).toString();
sanitizer.innerHTML = cleanHtml;
document.body.appendChild(sanitizer);
</script>
</body>
</html>
All versions
1.19.2
1.19.3
1.20.0
1.20.1
1.21.0
1.21.1
1.22.0
1.22.1
1.23.0
1.24.0
1.25.0
1.26.0
1.27.0
1.27.1
1.27.2
1.27.3
1.27.4
1.27.5
2.0.0
2.1.0
2.1.1
2.1.2
2.10.0
2.11.0
2.12.0
2.12.1
2.13.0
*** 2.13.1
2.2.0
2.3.0
2.3.1
2.3.2
2.3.3
2.4.0
2.5.0
2.5.1
2.5.2
2.5.3
2.6.0
2.6.1
2.7.0
2.7.1
2.7.2
2.7.3
2.8.0
2.8.1
2.9.0