Aren't mailto links supposed to open in a new window?

Is there a way to force them?

Thanks

Comments

manoloka created an issue. See original summary.

elachlan’s picture

Status: Active » Postponed (maintainer needs more info)

Mailto links should do what is configured by the browser. I believe all it does is mark the link with the image and allow a message to be displayed.

Sumit Gawde’s picture

try this
<a id="mailto" href="your mail to address" target="_blank" >

Sumit Gawde’s picture

manoloka’s picture

@elachlan, I'm afraid I don't find anywhere within the browser's settings where to control the mailto links functionality.

@Sumit Gawde, I guess that should work, however I installed Extlink module not to have to do this manually on very other link. I tried to include "mailto" or "@" at the matching the pattern configuration but not working.

Thanks

elachlan’s picture

This module does not add links to your text.

It adds icons to links that match the criteria. so if you have an html anchor tag with a mailto link then it should show the letter icon. It does not change browser behaviour for links.

elachlan’s picture

Status: Postponed (maintainer needs more info) » Closed (won't fix)
Marcelfuji’s picture

I tried:

Include links matching the pattern
mailto || .pdf

This makes PDF files open in a new window but it doesn't make mailto links open in a new window.

philsward’s picture

If you don't mind hacking the module... (maybe someone can create a patch for this)

In ./js/extlink.js

Starting at line 114

1) Copy line 114 and 115, then paste directly below 115
2) Rename external_links to mailto_links
3) Change the comments for the external_links to reference web links
4) Change the comments for the mailto_links to reference mailto links

Save, clear caches and done.

Before

    if (settings.extlink.extTarget) {
      // Apply the target attribute to all links.
      $(external_links).attr('target', settings.extlink.extTarget);
      // Add rel attributes noopener and noreferrer.
      $(external_links).attr('rel', function (i, val) {

After

    if (settings.extlink.extTarget) {
      // Apply the target attribute to all web links.
      $(external_links).attr('target', settings.extlink.extTarget);
      // Apply the target attribute to all mailto links.
      $(mailto_links).attr('target', settings.extlink.extTarget);
      // Add rel attributes noopener and noreferrer.
      $(external_links).attr('rel', function (i, val) {

Closed as "won't fix"... serious? I don't even know what I'm doing when it comes to coding and figured out that adding one line of code is all that's needed... What I don't know how to do, is create a unique admin checkbox to control the behavior between web-links or mail-links but in all honesty, if you want one you probably want both so there isn't much need for the extra admin option.

If you want true simplicity, you could even forget about the comments and just add it like this:

      // Apply the target attribute to all links.
      $(external_links).attr('target', settings.extlink.extTarget);
      $(mailto_links).attr('target', settings.extlink.extTarget);

On a side note, I can't get the "'noopener noreferrer'" code to work on both link types. Maybe someone more knowledgeable can figure it out.