JavaScript mailto using the open window
source link: https://www.codesd.com/item/javascript-mailto-using-the-open-window.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
JavaScript mailto using the open window
I currently have a form set up with 5 radio options. I have a switch statement depending on the option you pick and that determines where the email is going to go.
Inside my switch, I have this piece of code.
window.open("mailto:"+emailTo+'?cc='+emailCC+'&subject='+emailSub+'&body='+emailBody);
It all works fine when it opens up my email client with all of the content however it also opens a blank page in the browser.
Is there another way to achieve this or prevent a blank window from opening but still make it as if you clicked on the href:mailto ?
Instead of:
window.open("mailto:"+emailTo+'?cc='+emailCC+'&subject='+emailSub+'&body='+emailBody);
You can try:
location.href = "mailto:"+emailTo+'?cc='+emailCC+'&subject='+emailSub+'&body='+emailBody;
Related Articles
How to close the tab without using the open window
Error while using the Open Graph Facebook API when connecting
Write a code to find the opening windows on the desktop
How can I enumerate the open windows (~ EnumWindows) of another user session
Using the usual Windows Print dialog box instead of the Java dialog box
How to increment a value in a text file using the standard Windows command line?
How can I specify that a Word TableCell should not be returned using the Open XML SDK?
run an oracle stored procedure from the sql server by using the open query function
Advantage of using the prefix 'window' in javascript
How to keep the focus on the open window using & ldquo; window.Open & ldquo; after the page load of the parent page?
Iframe / Popup redirection of the opening window
Javascript window.print () in chrome, closing a new window or tab instead of canceling printing leaves javascript blocked in the parent window
Using the Command Window in Visual Studio
Changing the address of the opening window in IE8
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK