window.location.hash.substring在火狐中的bug致使返回字符串被编码

如图:浏览器

在火狐浏览器中window.location.hash.substring(1)返回字符串被编码,例如<script>alert(1)</script>返回后成为%3Cscript%3Ealert(1)%3C/script%3Ethis

这是在火狐浏览器中的bug,在其余浏览器中是正常返回的,例如(电脑暂时只有firfox就用手机uc代替了):编码

window.location.hash should always return urlencoded string, but this is a bug in Firefox
url

参考:http://stackoverflow.com/questions/824040/doing-substring-in-window-location-hash#code

相关文章
相关标签/搜索