Javascript mailto function loading issue - Stack Overflow

I'm using JavaScript mailto function and when clicking on the button the mail loads in the same ta

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
Add a ment  | 

2 Answers 2

Reset to default 4

Use 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.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745596671a4635157.html

相关推荐

  • Javascript mailto function loading issue - Stack Overflow

    I'm using JavaScript mailto function and when clicking on the button the mail loads in the same ta

    14小时前
    40

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信