4

I have the following javascript function which should open (in our case lotus notes), with a prefilled email.

function emailpage() {
    strTitle = document.title;
    strTitle = strTitle.replace("&","-");
    window.location = "mailto:" + "?subject=I thought this link might interest you." + "&body=" + strTitle + " - " + window.location;
}

but instead I am getting this:

enter image description here

Luis Valencia
  • 32,619
  • 93
  • 286
  • 506

1 Answers1

4

Replacing body and subject should help you:

function emailpage() {
    strTitle = document.title;
    strTitle = strTitle.replace("&","-");
    window.location = "mailto:?body=" + strTitle + " - " + window.location + "&subject=I thought this link might interest you.";
}
Konstantin Rudy
  • 2,237
  • 25
  • 22
  • 1
    this worked, but not 100% of the times, in some pages it didnt work, so I tried the EncodeURI from @andreas and it works 100% – Luis Valencia Jul 23 '13 at 08:57