Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Aren't mailto links supposed to open in a new window?
Is there a way to force them?
Thanks
Comments
Comment #2
elachlan CreditAttribution: elachlan commentedMailto 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.
Comment #3
Sumit Gawde CreditAttribution: Sumit Gawde as a volunteer commentedtry this
<a id="mailto" href="your mail to address" target="_blank" >
Comment #4
Sumit Gawde CreditAttribution: Sumit Gawde commentedComment #5
manoloka CreditAttribution: manoloka commented@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
Comment #6
elachlan CreditAttribution: elachlan commentedThis 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.
Comment #7
elachlan CreditAttribution: elachlan commentedComment #8
Marcelfuji CreditAttribution: Marcelfuji commentedI 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.
Comment #9
philsward CreditAttribution: philsward commentedIf 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
After
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:
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.