Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Safari mailto: "This website has been blocked from automatically composing an email."

When using Safari (iOS 10.2) and clicking on a mailto link a confirmation prompt is shown with the following message:

"This website has been blocked from automatically composing an email." Ignore / Allow

I'd like to get rid of this on my own site and don't know what to do. It can be reproduce with Safari e.g on any BBC article clicking the mail icon.

Screenshot of dialogue on iPad

My web research brought me to these links:

https://discussions.apple.com/thread/7763735

WillieFromColo Jan 11, 2017 8:25 AM in response to Russ G

Issues with Safari and "This website has been blocked from automatically composing an email."

My research on Google suggests that this Error-type Message started happening in about November with an update to Safari, which likely occurred concurrently with Apple's update to iOS 10.2. As of today (1/11/17) that is the latest version of iOS for iPads and perhaps iPhones, too.

[...]

and

https://developer.apple.com/safari/technology-preview/release-notes/#r15

Release 15 URL Handling

Navigations to tel: and mailto: links now require a user gesture; navigations without a user gesture will show a confirmation prompt

So it seems like a Safari "feature". Does anyone know how to prevent this prompt?

like image 829
Johannes Horak Avatar asked Feb 07 '17 09:02

Johannes Horak


1 Answers

Various third party JavaScript libraries will intercept clicks on a tags in order to prevent navigation briefly while sending data to a server. Typically, they programatically trigger navigation via window.location.replace.

The change in Safari pops the warning when mailto/tel links are triggered in this way.

There was an interaction, but that's usually been stopped with preventDefault, and Safari doesn't care.

If you're using a library that's causing this issue, contact the creator and see if they can update it to skip preventDefault on mailto/tel links.

like image 62
jmc Avatar answered Sep 29 '22 02:09

jmc