admin管理员组文章数量:1023773
I'm using JavaScript mailto
function and when clicking on the button the mail loads in the same tab. How can I load the mail in a new tab?
Here's my code:
<input type="button" value="Apply" name="apply" onclick="mailJob('Sample');">
function mailJob(code)
{
window.location="mailto:[email protected]?subject="+code;
}
I'm using JavaScript mailto
function and when clicking on the button the mail loads in the same tab. How can I load the mail in a new tab?
Here's my code:
<input type="button" value="Apply" name="apply" onclick="mailJob('Sample');">
function mailJob(code)
{
window.location="mailto:[email protected]?subject="+code;
}
Share
Improve this question
edited Jul 21, 2012 at 19:26
Nikola K.
7,15513 gold badges32 silver badges39 bronze badges
asked Jul 21, 2012 at 19:17
I'm nidhinI'm nidhin
2,6726 gold badges39 silver badges65 bronze badges
1
- read here: stackoverflow./questions/5141910/… – Yan Berk Commented Jul 21, 2012 at 19:18
2 Answers
Reset to default 4Use window.open
function.
window.open('mailto:[email protected]?subject='+code, '_blank')
Read more here.
window.location will redirect the current page to the indicated url. In order to open a new window or tab, you need to do window.open, as is shown in answer that Yan linked to.
I'm using JavaScript mailto
function and when clicking on the button the mail loads in the same tab. How can I load the mail in a new tab?
Here's my code:
<input type="button" value="Apply" name="apply" onclick="mailJob('Sample');">
function mailJob(code)
{
window.location="mailto:[email protected]?subject="+code;
}
I'm using JavaScript mailto
function and when clicking on the button the mail loads in the same tab. How can I load the mail in a new tab?
Here's my code:
<input type="button" value="Apply" name="apply" onclick="mailJob('Sample');">
function mailJob(code)
{
window.location="mailto:[email protected]?subject="+code;
}
Share
Improve this question
edited Jul 21, 2012 at 19:26
Nikola K.
7,15513 gold badges32 silver badges39 bronze badges
asked Jul 21, 2012 at 19:17
I'm nidhinI'm nidhin
2,6726 gold badges39 silver badges65 bronze badges
1
- read here: stackoverflow./questions/5141910/… – Yan Berk Commented Jul 21, 2012 at 19:18
2 Answers
Reset to default 4Use window.open
function.
window.open('mailto:[email protected]?subject='+code, '_blank')
Read more here.
window.location will redirect the current page to the indicated url. In order to open a new window or tab, you need to do window.open, as is shown in answer that Yan linked to.
本文标签: Javascript mailto function loading issueStack Overflow
版权声明:本文标题:Javascript mailto function loading issue - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745596669a2158212.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论