1.https://jsxss.com/zh/options....html
js-xss能够过滤标签全部的属性 只显示文本
2.标签过滤web
var html = filterXSS(contentValue,{ onTag : function (tag, html, options) { console.log(tag, html, options) if (tag === 'script') { return filterXSS(html); } else { // 不对其属性列表进行过滤 return html } } });
3.白名单过滤xss
var html = filterXSS(contentValue,{ whiteList: { span: ['style'], div: ['style'], p: ['style'], b: ['style'], strong: ['style'] } });