【问题标题】:Mailto link causes page to go blank in ie8Mailto 链接导致页面在 ie8 中变为空白
【发布时间】:2012-03-11 02:51:42
【问题描述】:

我的问题和这个帖子类似:mailto causing a blank page in IE8 when used with Dojo.

我有一个带有 mailto 链接的页面,当用户单击该链接时,电子邮件客户端按预期打开,但页面变为空白。这只发生在 ie8 中。

我已经尝试使用 target=_blank 打开电子邮件客户端,但问题仍然存在。我还尝试通过 Anchor 中的点击处理程序打开电子邮件客户端,而不是使用下面代码中的 mailto href。

Anchor link = new Anchor("foo@bar.com");
link.addClickHandler(new ClickHandler() {

@Override
public void onClick(ClickEvent event) { Windows.openEmail("foo@bar.com", ""); }
});

我猜问题出在保护模式上,但我需要它在 ie8 上工作,而无需要求用户在浏览器上进行任何配置。该应用程序在 Intranet 模式下运行,因此正如我链接的帖子中的一个回答所说,此错误不会“在发布到 Internet 时神奇地消失”。

我正在 GXT 中进行开发。请问有人有解决办法吗?

谢谢。

【问题讨论】:

标签: internet-explorer-8 anchor gxt mailto protected-mode


【解决方案1】:

使用隐藏的 iFrame 作为目标链接并在 href 中使用 javascript:window.open 为我解决了这个问题:

<a runat="server" target="iframe2" 
href="javascript:window.open('mailto:foo@bar.com')">Foo</a>
<iframe style="display: none" name="iframe2"></iframe>

希望对你有帮助。

【讨论】:

    猜你喜欢
    • 2010-12-13
    • 2020-02-17
    • 2012-11-03
    • 2010-10-12
    • 2022-10-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多