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

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

window.open mailto
javascript mailto
mailto open a new tab
how do i stop chrome from opening links in my email
why are my emails opening in a new tab
javascript window open mailto
mailto opens chrome instead of outlook
mailto html body

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 tab in the browser before opening the mailing application (Outlook, Gmail, etc).

Is there any way to prevent the blank tab from opening?


Edit: This issue is encountered in all following major browsers : Internet Explorer, Firefox and Google Chrome.

I am using window.open() to send emails, is there any known alternatives?

Here is how I send the email:

var mailto_link = 'mailto:'+email+'?subject='+subject+'&body='+body_message;
var win = window.open(mailto_link,'emailWindow');

I don't want to use window.location.href since I am displaying a message after the user sent the email.


Thank you for the edit. There is indeed an alternative:

window.location.href = "mailto:mail@domain.tld";
alert("Thank you!");

I don't want to use window.location.href since I am displaying a message after the user sent the email.

I did not really get this one. You are not leaving the website when using mailto: with window.location.href

Whenever I click on a mailto link Chrome opens a new window for , So I'd prefer to open the link in the code behind. .com/questions/13457684/how​-to-prevent-mailto-event-from-opening-a-new-tab-in-browser. For sake of argument lets try the 'mailto' url scheme. My code: window.open("mailto://Bob Lawblah", '_self'); Unfortunately this open up a new blank tab as well as opening up the default mail program even though I specified '_self'. According to this I don't seem to be anything wrong.


The window.location.href solution by AmShaegar works pretty well but it caused side effect in a complex application I have been developping.

I finally came up with this solution one might be interested in:

$('<iframe src="mailto:mail@domain.tld">').appendTo('body').css("display", "none");

See this plunker: http://plnkr.co/edit/J0LvQU?p=preview

Open mailto: link in code behind, But if a user has a browser-based email client set up, it does matter. I've weighed in on opening links in new tabs before, but not specifically  this information is outdated, now it is possible to do so i believe, since gmail and others now work via browser links. there is however the problem that you would only want it to open in a new tab if NOT opening in a system mail client, and open in a new tab if it is a webmail client, otherwise for example Outlook users see a blank tab appear, which is disorienting, especially since they are


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.

All About mailto: Links, Thanks for editing. There is really an alternative: window.location.href = "mailto:​mail@domain.tld"; alert("Thank you!"); I do not want to use window.location.href  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 tab in the browser before opening the mailing application (Outlook, Gmail, etc). Is there any way to prevent the blank tab from opening?


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);

How to prevent mailto event from opening a new tab in a browser , I've tried both the built-in email option and manually typing “mailto:” When doing that, I had “Open in new tab” unchecked. But that Untitled tab in your screenshot is exactly what I'm trying to avoid because it's not needed. Click the "Show advanced settings" link to view the advanced settings. Click the "Content settings" button in the Privacy section to open the Content Settings window. Click the "Do not allow any site to show pop-ups (recommended)" radio button in the Pop-ups section to stop sites from opening advertisements. 4.5k views


Try naming the window (myWindow) and adding a close() command:

<script>
    myWindow=window.open("mailto:emailaddress@example.com");
    myWindow.close();
</script>';

This should close the extra browser window and keep the email application open. At least it worked for me.

"Mailto" link opens empty new tab - Layout, Solved: I am using a simple anchor link and mailto link, in an HTML Text control: "​Primary Both of them cause my browser (Chrome) to open a new tab. Every time I open Opera it opens Facebook by default (which is what I want), but it also always opens a new tab as the active tab. I have to always click the X to close that new tab in order to see the Facebook tab. How can I get Opera to open just the Facebook tab without opening a new tab along with it?


Solved: Prevent HTML links from opening a new tab, Hi I have a few users that are reporting that when ever they click a mailto web link it opens up a blank page in the default browser before opening a new email. It would be nice if you could prevent opening tabs in the default web browser and instead open the link in the current (rambox) window/tab. A Google search tells me browsers can either do what the page/link tells it to, or override it to force a new tab or force it to open in the current one. Steps to reproduce. Change to new Outlook web interface


mailto links on a webpage are opening up a blank browser page , Join us now for our digital event from June 30th to July 2nd at web.dev/live If you use Gmail you may become frustrated when you click a mailto: link by accident and now your desktop First, open up a Gmail tab. Accept the confirmation from the browser. Click this mailto: link to test out your new Gmail mailto hookup!


Getting Gmail to handle all mailto: links with registerProtocolHandler, Busque trabalhos relacionados com How to prevent mailto event from opening a new tab in browser ou contrate no maior mercado de freelancers do mundo