以下代码在两台不同的计算机上都会失败(两台Windows 7,Chrome 12.0.742.100)。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Test</title>
<script type="text/javascript">
location.hash = "#one";
location.hash = "#two";
location.hash = "#three";
</script>
</head>
<body>
This will error out "Uncaught Error: can't load XRegExp twice in the same frame" in chrome. Anyone got an answer?
</body>
</html>
我觉得我尝试了一切。任何人都可以在chrome上确认这个错误,有没有人知道我如何修复它?非常感谢。
错误的网址: http://jalsoedesign.net/test/hashchanging/
我应该添加: 它运行正常,它应该做什么(更改页面哈希值),但仍然出现错误。
答案 0 :(得分:11)
在Win7上的Chrome 12.0.742.100上,它可以正常使用。我假设你已经安装了扩展程序?禁用所有扩展程序(或进入隐身模式)并尝试重新加载您的页面。内容脚本中的错误也会显示在javascript控制台中。如果您未在网页上使用XRegExp,则可能是其中一个扩展程序。
修改强>
例外的来源应位于右侧。单击它以转到导致异常的脚本。
答案 1 :(得分:2)
使用XRegExp的扩展程序应升级到v2.0.0或更高版本。即使XRegExp在同一帧中(不恰当地)加载了多次,也会避免此错误。