Search code examples
htmlinternet-explorersharepoint-2007web-partsmailto

mailto in IE breaks after adding Search Core Results Web Part


I'm trying to create a link that pops open a new email in outlook:

<a href="mailto:[email protected]?subject=blah">Feedback</a>

and this works fine in firefox, but in IE9 it's literally redirecting the browser to "mailto:[email protected]?subject=blah". The email window still pops up but I need IE to remain on the same page where the mailto link was clicked.

EDIT: I have now pinpointed this to being a SharePoint 2007 problem. The mailto href works fine before adding a Search Core Results webpart to the page, but after adding the Core Results webpart, the previously described problem takes place.


Solution

  • I still dont know what the exact cause of the problem is but I was able to get around it by doing the following:

    Add a hidden iframe to the page:

    <iframe id="emailiframe" src="" style="display:none;"></iframe>
    

    In the content editor web part that contains my "feedback" link, I set the source to:

    <script type="text/javascript">
    function feedbackEmail()
    {
    var iframe = document.getElementById("emailiframe");
    iframe.setAttribute("src", "mailto:[email protected]?subject=blah");
    }
    </script>
    
    <a href="javascript:void(0);" onclick="feedbackEmail(); return false;">Feedback</a>
    

    IE now does what it's supposed to.