window.location.hash.substring

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

偶尔善良 提交于 2019-12-27 18:07:22
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 如图: 在火狐浏览器中window.location.hash.substring(1)返回字符串被编码,例如<script>alert(1)</script>返回后成为%3Cscript%3Ealert(1)%3C/script%3E 这是在火狐浏览器中的bug,在其他浏览器中是正常返回的,例如(电脑暂时只有firfox就用手机uc代替了): window.location.hash should always return urlencoded string, but this is a bug in Firefox 参考: http://stackoverflow.com/questions/824040/doing-substring-in-window-location-hash# 来源: oschina 链接: https://my.oschina.net/u/947688/blog/515437