html – Safari mailto:“此网站已被阻止自动撰写电子邮件.”

前端之家收集整理的这篇文章主要介绍了html – Safari mailto:“此网站已被阻止自动撰写电子邮件.”前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
使用Safari(iOS 10.2)并单击mailto链接时,将显示确认提示,并显示以下消息:

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

我想在我自己的网站上摆脱这个,不知道该怎么做.它可以通过Safari重现,例如在点击邮件图标的任何BBC文章中.

Screenshot of dialogue on iPad

我的网络研究带我到这些链接

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.

[…]

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

所以它似乎是Safari的“功能”.有谁知道如何防止这个提示

解决方法

各种第三方JavaScript库将拦截属性上的点击,以防止在向服务器发送数据时短暂导航.通常,它们以编程方式通过window.location.replace触发导航.

当以这种方式触发mailto / tel链接时,Safari中的更改会弹出警告.

有一个交互,但通常使用preventDefault停止,Safari不关心.

如果您正在使用导致此问题的库,请与创建者联系,看看他们是否可以更新它以跳过在mailto / tel链接上的preventDefault.

猜你在找的HTML相关文章