Firefox 正在运行document.location.hash="&引用;作为DOM中的第一件事';不要清除URL
document.location.hash=”“在URL中将哈希设置为#。但是,当我在DOM中首先运行它时,它在Firefox(至少在Firefox 5.0.1)中不起作用。有什么想法吗 尝试访问Firefox和其他浏览器,了解我的意思Firefox 正在运行document.location.hash="&引用;作为DOM中的第一件事';不要清除URL,firefox,url,dom,hash,Firefox,Url,Dom,Hash,document.location.hash=”“在URL中将哈希设置为#。但是,当我在DOM中首先运行它时,它在Firefox(至少在Firefox 5.0.1)中不起作用。有什么想法吗 尝试访问Firefox和其他浏览器,了解我的意思 <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <title>Hash test</title>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Hash test</title>
<script type="text/javascript">
document.location.hash="";
</script>
</head>
<body>
<p>The hash won't be set to <b>#</b> in Firefox. (At least in Firefox 5.0.1)</p>
</body>
</html>
散列测试
document.location.hash=“”;
在Firefox中,哈希值不会设置为#。(至少在Firefox 5.0.1中)
这是一个bug。确切地说(我相信是你提出的)
如果您想暂时解决这个问题,请将
document.body.offsetWidth
添加到location.hash
集合之前的脚本中。这将创建可滚动布局对象,该对象的不存在会导致错误,从而阻止位置在没有错误修复的情况下更改。谢谢。是的,我确实把bug归档了。