Reputation: 2662
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;
}
Upvotes: 1
Views: 6212
Reputation: 722
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.
Upvotes: 0
Reputation: 7155
Use window.open
function.
window.open('mailto:[email protected]?subject='+code, '_blank')
Read more here.
Upvotes: 4