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

时间:2021-10-14 17:33:20

In my JSP, I have a hyperlink. Onclick of it, I need to open a mailTo outlook window. In IE9, I had an issue "Internet Cannot display Webpage" when I directly gave href='mailTo:test@email.com while opening the outlook window. For which I made a fix like below:

在我的JSP中,我有一个超链接。点击它,我需要打开一个mailTo outlook窗口。在IE9中,当我在打开Outlook窗口时直接给出href ='mailTo:test@email.com时,我遇到了“Internet无法显示网页”的问题。为此我做了如下修复:

JSP code:

<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. Instead, it introduced an issue where in IE9 COMP ON, outlook window opens twice and IE8, script error comes when outlook window opens.

此修复解决了IE9中发生的问题。相反,它引入了一个问题,在IE9 COMP ON中,Outlook窗口打开两次,IE8,Outlook窗口打开时出现脚本错误。

1 个解决方案

#1


0  

My issue got resolved after i changed my script code from this

我改变了我的脚本代码后,我的问题得到了解决

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

To

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

#1


0  

My issue got resolved after i changed my script code from this

我改变了我的脚本代码后,我的问题得到了解决

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

To

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