Question

I would like to open the following in a new window or tab. Currently it opens in the same window so that after sending the email, the page must be reloaded. This is a part of this webpage

function email_message()
{
   bodytext = document.getElementById("end").value;

   if (bodytext.length > 1850)
   {
      alert("Oops!  The E-Mail Someone button can only be used for short messages, 3 or    less lines of message text.  \nYou can always copy the Encoded Message and past into your regular email!")
      return;
   }
   who_to = prompt("Enter recipient's email address: ","anybody@anywhere.com");
   s_line = "Encoded Message";

   var confirm_send = confirm("Send Email?");
   if (confirm_send == true)
   {
      parent.location.href = 'mailto:' + who_to + '?subject=' + s_line + '&body=' + "Decode at www.mysite.com/myhtml.htm%0D%0D" + bodytext;
   }
   else
   {
   return;
   }
}
Was it helpful?

Solution

Use window.open

You just needs this bit of code below to open the page in a new window,Have tried this

window.open(url, '_blank');
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top