Is there a way to use the mailto: or message: scheme in a PWA in iOS 12.2?

China☆狼群 提交于 2020-01-14 13:51:15

问题


I've built a PWA using Ionic 4 that had a "Contact" Button with a simple href using the 'mailto:' scheme.

<a href="mailto:example@gmail.com">Contact</a>

This used to open the native Mail app in iOS 12.1 when starting the PWA from homescreen. Since I updated to iOS 12.2 it just opens the PWA internal Safari with a message that Safari can't open links starting with 'mailto:'

I have tried using other URI schemes like 'instagram:' or 'message:' but they all lead to the same problem. The only one that I have found to still be functional when I start my PWA from homescreen is the 'tel:' scheme.

Has anyone else encountered this problem and has any idea how to still open URI schemes other than tel: from a PWA that has been opened from homescreen?


回答1:


I have a PWA which is installed on iOS 12.2, my link uses target="_blank" and it works. Did you try this ?

Have a nice day,




回答2:


I managed to get it working using the below click function. Tested on both Android and iOS PWA.

()=>{
    window.location.href = "mailto:support@example.com?subject=" + emailSubject + "&body=" + emailBody
    return
}


来源:https://stackoverflow.com/questions/55610036/is-there-a-way-to-use-the-mailto-or-message-scheme-in-a-pwa-in-ios-12-2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!