页面前端输入框验证js代码,防止xss


demo

类似这种简单的输入框,输入不限制特殊字符输入的情况下,怎么去检测处理类似这种问题。

直接检测 "<script>" 字符串来 判断处理么?

这方面问题有什么比较好的处理方案么?

就这么如下处理的话,在前端安全方面还有哪些很欠考虑的点呢?


 var html = html.replace(/</g, "<").replace(/>/g, ">");

前端安全 前端 网络安全 HTML JavaScript

jjfjj 12 years, 11 months ago
坑爹呢这是......啪 answered 12 years, 11 months ago

Your Answer