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'] } });