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

后端 未结 8 1581
一个人的身影
一个人的身影 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:13

    For the record:

    create a anchor tag with the target attribute like this:

    <div>
        <a target="_self" href="mailto:mail1@domain1.com;%20mail2@domain2.com?subject=Mail%20sending&body=etc...">
            Send Mail
        </a>
    </div>
    
    0 讨论(0)
  • 2021-02-05 03:20

    The blank tab is opened by window.open(). You don't need that.

    The syntax for a mailto link should be something like

    <a href="mailto:your@email.address?subject=Comments about the color blue">Contact Us</a>
    

    See http://www.addressmunger.com/mailto_syntax_tutorial/ for more details.

    0 讨论(0)
提交回复
热议问题