Window.location.href = mailto在Google Chrome中无效(版本35.0.1916.153 m)

时间:2014-07-11 15:44:15

标签: javascript google-chrome href mailto

我遇到了一个问题,我找不到任何解决方法。我有一个由onClientClick触发的javascript函数。它适用于Firefox和IE9,但不适用于chrome。

function PopUpMailRevision() {
        var email = document.getElementById("<%=hlEmail.ClientID%>").innerHTML;
        var travelRequestID = document.getElementById("<%=lblRequestID.ClientID%>").innerHTML;
        var travelRequestRev = document.getElementById("<%=lblRequestRevision.ClientID%>").innerHTML;
        var body = 'Below you will find the reason(s) for which your Travel Request was returned for revision.'
        var subject = 'Travel Request ' + travelRequestID + ' Version #' + travelRequestRev + ' returned for revision.';

        location.href = "mailto:" + encodeURIComponent(email) + '?subject=' + encodeURIComponent(subject) + '&body=' + encodeURIComponent(body);

    }

基本上我只需要在点击特定按钮时将默认电子邮件客户端设置为PopUp。就像我说的,这适用于IE和Firefox但不适用于chrome。奇怪的是,单击chrome中的mailto超链接将使默认电子邮件客户端打开。任何人有一个解决方法吗?

谢谢。

0 个答案:

没有答案