How to prevent mailto event from opening a new tab in browser

后端 未结 8 1588
一个人的身影
一个人的身影 2021-02-05 02:36

I am using a mailto: filled in JavaScript to send information throughout my web application, but everytime a user presses the Send button, it opens a new t

8条回答
  •  滥情空心
    2021-02-05 03:11

    Just close the window after a short interval:

    var mailto_link = 'mailto:'+email+'?subject='+subject+'&body='+body_message;
    var win = window.open(mailto_link,'emailWindow');
    setTimeout(function() { win.close() }, 500);
    

提交回复
热议问题