Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Firefox 正在运行document.location.hash="&引用;作为DOM中的第一件事';不要清除URL_Firefox_Url_Dom_Hash - Fatal编程技术网

Firefox 正在运行document.location.hash="&引用;作为DOM中的第一件事';不要清除URL

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>

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>
  <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归档了。