Mailto links in iOS not working
Asked Answered
C

2

12

Whenever I try to add a simple mailto link, all devices except iOS work fine.

Based on Apple iPhone Documentation it should work as such:

<a href="mailto:[email protected]">John Frank</a>

But I made a new post on a WordPress site that contains the URL exactly as such and when tapping it on iPhone (iPhone 7 simulator and real iPhone 6) it just gives an error:

enter image description here

Clarenceclarenceux answered 20/2, 2017 at 13:32 Comment(2)
I tried this page and it works: w3schools.com/html/tryit.asp?filename=tryhtml_mailto Then I tried editing the link, removing the "target" attribute, and on my iPhone 7 the link stopped working. Then I did a 3D Touch on the link and I saw a dialog stating the website wasn't allowed to open links and was given the opportunity to cancel or allow.Oneiromancy
@ryan have you resolved it?Incoming
N
19

Use a real device, not the simulator. Mail and phone apps are not installed on the simulator, so you can't use them.

From Mail Links in the Apple URL Scheme Reference:

iOS Note: If the Mail app is not installed, clicking a mailto URL displays an appropriate warning message to the user.

Noncompliance answered 24/4, 2018 at 17:22 Comment(1)
"an appropriate warning message" It shows nothing at all. I even have the mail app installed.Algeciras
M
-4

You can adding onclick event and get it done:-

<a href="#" onclick="window.location='[email protected]'; return false;" class="noHighlight">John Frank</a>

Hope it helps!

Murvyn answered 20/2, 2017 at 13:34 Comment(1)
That just triggers a redirect to the url [email protected]Freed

© 2022 - 2024 — McMap. All rights reserved.