Win 7 & IE8 & javascript & Mailto: RRS feed

  • Question

  • Hi
    I have a webpage with javascript, this javascript calls mailto. 
    When I click this mailto: on IE 8 and win xp it opens the outlook  and my page does not postback or refresh and stays in place. that is my page works fine.

    However when I use IE8 and Win 7, when click the mailto:, I Could see my outlook fires, but the page gets lost i.e. try to redirect to the mailto: i.e, in the url i see mailto: 

    What is wrong with it.

    Please help.

    Satish kumar P
    Wednesday, February 24, 2010 7:07 AM

All replies

  • Hi,

    Please supply a link to your web page.

    Thursday, February 25, 2010 5:09 AM
  • HI,

    I am also facing a similar issue.  i have a popup which opens an outlook mail message before closing. we are using below code to do that,


    window.location.href = "mailto:?subject="+subject+"&body="+bodyValue;



    In IE8, the Outlook opens with correct subject and body, but the pop up window from which this is called doesn’t close even though we are calling window.close(), and also it shows a blank page(it hangs).  

    In IE6 the same functionality works fine and closes the pop-up window from which we invoke the mailto tag.

    Also in IE8 when we disable the protected mode, this feature works fine like IE6 but customer won’t agree on changing default browser settings.


    Monday, March 8, 2010 8:06 AM
  • no link supplied, we can read code but...

    Have you validated your markup? The solution offered will depend upon your DTD on your page. You don't have IE's debugging options turned on, otherwise you would be receiving scripting errors that would point to the problem.

    Design pattern

    <button onclick="javascript:window.location.href=\'mailto:?subject=\'+subject+\'&body=\'+bodyValue;window.close();return false;">mail to</button>

    don't use <input type="button" within a form block otherwise it will raise the forms' onsubmit event also.

    <a href="#" onclick="javascript:

    window.location.href = \'mailto:?subject=\'+subject+\'&body=\'+bodyValue;

    window.close();return false;" >mail to</a>


    run your pages through




    Install the Tidy HTML extension in Firefox to detect incorrectly escaped JS strings.

    Saturday, September 25, 2010 11:42 PM
  • sorry... that is incorrect (ofcoarse, no link... we only guess)


    onclick="window.location.href='mailto?subject='+subject.replace('\'','\\'')+'&body='+bodyValue.replace('\'','\\'');window.close();return false;"

    If bodyValue is html markup you will have to escape it first.

    Sunday, September 26, 2010 2:59 AM