Xss解决办法

2017-02-11  本文已影响0人  Sccong
<!DOCTYPE html>
<html lang="en">
<head>
   <meta charset="UTF-8">
   <title>Document</title>
</head>
<body>
   <div id='a'>p</div>
   <div id='b'>ss</div>
</body>
<script>
   document.getElementById('a').innerText='这是通过text<hr/>修改的内容'
   document.getElementById('b').innerHTML='这是通过innerhtml<hr/>修改的内容'
</script>
</html>

你会到通过innerText输入的标签不会被编译

例如< 符号变成 <
上一篇 下一篇

猜你喜欢

热点阅读