0
$('#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 上抛出的。

4

2 回答 2

1

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

于 2015-06-24T12:22:06.840 回答
0

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

于 2012-04-19T19:42:33.093 回答