Can Email Links open in new window?
-
02-06-2021 - |
Question
I have this line of code:
<a href="mailto:test@hotmail.com?subject=test&body=test" target="_blank">test</a>
But the target="_blank"
is not working. It always opens the mail server in the same window but not in new. What I am doing wrong?
La solution
It always opens the mail server in the same window but not in new.
You've got no control over how the user's client will handle mailto:
URLs. It may choose to ignore them completely (as my client does), it may start up a new program such as mutt
or pine
or kmail
or thunderbird
, or whatever; or it might even load a web-mail client using a browser-specific plugin.
You cannot control what happens on the client's machine when handling a mailto:
URL -- you'd better not waste your time trying to fiddle with it, because it will only ever be meaningful on your development machine.