Javascript mailto使用窗口打开 [英] Javascript mailto using window open
本文介绍了Javascript mailto使用窗口打开的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我目前有一个表格设置有5个无线电选项。我有一个switch语句,具体取决于你选择的选项,它决定了电子邮件的去向。
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.
是否有其他方法可以实现此目的或阻止空白窗口打开,但仍然可以使其像点击href:mailto一样? / p>
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 ?
推荐答案
而不是:
window.open("mailto:"+emailTo+'?cc='+emailCC+'&subject='+emailSub+'&body='+emailBody);
您可以尝试:
location.href = "mailto:"+emailTo+'?cc='+emailCC+'&subject='+emailSub+'&body='+emailBody;
这篇关于Javascript mailto使用窗口打开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文