简体   繁体   English

尝试在IE9中使用iFrame打开Outlook两次?

[英]Outlook opens twice when trying to open using iFrame in IE9?

In my JSP, I have a hyperlink. 在我的JSP中,我有一个超链接。 Onclick of it, I need to open a mailTo outlook window. Onclick它,我需要打开mailTo Outlook窗口。 In IE9, I had an issue "Internet Cannot display Webpage" when I directly gave href='mailTo:test@email.com while opening the outlook window. 在IE9中,当我在打开Outlook窗口时直接给href='mailTo:test@email.com时,出现了“ Internet无法显示网页”的问题。 For which I made a fix like below: 为此,我进行了如下修复:

JSP code: JSP代码:

<iframe id="<portlet:namespace />emailiframe" src="" style="display:none;"></iframe>
<a href="javascript:<portlet:namespace />feedbackEmail('test@email.com');">
<c:out value="sendFeedback" /></a>

Script Code: 脚本代码:

<script type="text/javascript">
function <portlet:namespace />feedbackEmail(mailID)
{
  var iframe = document.getElementById("<portlet:namespace />emailiframe");
  iframe.setAttribute("src", "mailto:"+mailID);
}

This fix solved the issue happened in IE9. 此修复解决了IE9中发生的问题。 Instead, it introduced an issue where in IE9 COMP ON, outlook window opens twice and IE8, script error comes when outlook window opens. 相反,它引入了一个问题,即在IE9 COMP ON中,Outlook窗口打开两次,而在IE8中,Outlook窗口打开时出现脚本错误。

My issue got resolved after i changed my script code from this 从此更改脚本代码后,问题得到解决

iframe.setAttribute("src", "mailto:"+mailID);

To

document.getElementById('emailiframe').src = "mailto:"+mailID;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM