当我在IE中的URL下执行时,我收到警报消息:
URL : https://test.com/test?path=valid</script><svg/onload=alert(window.location.href)>
但是在chrome中同样可以正常工作(无警报)。
对于chrome,当我检查开发工具时,URL以编码格式显示。如何在IE中实施编码并防止XSS攻击。
答案 0 :(得分:0)
在执行url之前,您可以使用encodeURI() Function对url进行编码。
为防止XSS攻击,您可以尝试启用IE浏览器的XSS筛选器,请打开IE Internet设置,在安全Internet区域中单击“自定义级别...”,然后启用XSS筛选器。有关XSS过滤器的更多详细信息,请参阅this thread。