test.html 328 B

123456789101112131415
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <title>测试</title>
  5. <meta charset="utf8">
  6. </head>
  7. <body>
  8. <pre id="result"></pre>
  9. </body>
  10. </html>
  11. <script src="xss.js"></script>
  12. <script>
  13. var code = '<script>alert("xss");</' + 'script>';
  14. document.querySelector('#result').innerText = code + '\n被转换成了\n' + filterXSS(code);
  15. </script>