一、下载
https://gitcode.com/gh_mirrors/js/js-xss
二、使用示例
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>xss</title>
</head>
<body>
<textarea name="" id=""></textarea>
<button class="submit">提交</button>
<script src="./xss.js"></script>
<script>
const textarea = document.querySelector('textarea');
const submit = document.querySelector('.submit');
submit.addEventListener('click', () => {
const value = textarea.value;
console.log(value);
var html = filterXSS(value);
alert(html);
});
</script>
</body>
</html>