Have you ever clicked on a mailto link and found yourself redirected to an unfamiliar email client?
It can be frustrating to have to copy and paste the email address into your preferred email service.
But, what if your preferred email service is Gmail?
In this tutorial, we’ll show you how to open mailto links in a new tab that have Gmail as the default mail.
Understanding Mailto Links
Before we dive into the solution, let’s take a moment to understand what mailto links are.
Mailto links are HTML links that, when clicked, open an email composition window with the recipient’s email address pre-filled.
This feature allows website visitors to quickly and easily send an email without having to manually type out the recipient’s email address.
The Problem with Mailto Links and Gmail
By default, when you click on a mailto link, your computer’s default email client will open.
This default email client may not be the email service you use or prefer, such as Gmail.
This can be a hassle, especially if you’re used to composing emails in Gmail and have your contacts and templates set up there.
Solution:Open Mailto Links in a New Tab with Gmail as the Default Mail
There’s a simple solution to this problem – you can open mailto links in a new tab with Gmail as the default mail.
Follow these steps to do so:
- Copy and paste the following code into a plain text editor, such as Notepad:
javascript:window.open('https://mail.google.com/mail/?extsrc=mailto&url=' + encodeURIComponent(window.location.href))- Save the file as “gmail.js” and remember the location where you saved it.
- Open your preferred web browser, such as Chrome or Firefox.
- Click on the three dots (or three lines) in the upper right-hand corner of your browser window to open the browser menu.
- Select “Settings” from the menu.
- Scroll down and click on “Advanced” to open the advanced settings.
- Click on “Privacy and security.”
- Click on “Site settings.”
- Scroll down and click on “Additional content settings.”
- Click on “Manage handlers.”
- Click on the “Add” button to add a new protocol handler.
- In the “Protocol” field, enter “mailto.”
- In the “Handler” field, enter the location of the “gmail.js” file that you saved in Step 2.
- Click on “Add.”
That’s it!
Now, when you click on a mailto link, it will open in a new tab with Gmail as the default mail.
This will save you time and frustration when composing emails from a website.
Conclusion
Mailto links are a convenient way to send emails from websites, but they can be frustrating if your default email client is not the service you prefer.
By following the simple steps outlined in this tutorial, you can open mailto links in a new tab with Gmail as the default mail.
This will save you time and make your emailing experience more seamless.
Give it a try and see how it works for you!




