JavaScript错误:在IE8中的window.open上“调用的对象与其客户端断开连接”

时间:2012-04-19 19:33:24

标签: javascript internet-explorer internet-explorer-8

$('#intent').click(function (e) {
  e.preventDefault();
  window.open(e.target.href, 'intent', 'width=560,height=520,location=0,resizable=0,scrollbars=0,startus=0,titlebar=0,toolbar=0');
});

在Internet Explorer 8中,此代码抛出一个JavaScript错误:“调用的对象已与其客户端断开连接。”代码非常简单。我觉得我之前写过几乎完全相同的东西。我不确定为什么它现在会抛出一个错误。

这是HTML:

<a href="https://twitter.com/intent/user?screen_name=iancmyers" id="intent">@iancmyers</a>

IE8调试工具说错误是在window.open上抛出的。

2 个答案:

答案 0 :(得分:0)

我的猜测是锚标记的默认行为(导航到它的href)和点击事件之间的冲突。尝试从锚中删除href属性,在javascript中对其进行硬编码(至少现在),看看是否有帮助。

答案 1 :(得分:0)

如果有人正在研究这个问题,我发现使用IE11,如果我传递给window.open()的目标URL执行重定向到另一个URL,则会出现此问题。

相关问题