通过 HTML 在 Whatsapp 上启用社交分享的优雅方式

Graceful way to enable social sharing on Whatsapp via HTML

我正在使用 HTML 在移动网站的 Whatsapp 按钮上生成分享,如下所示:

<a rel="nofollow" target="_blank" href="whatsapp://send?text=https://example.com" data-link="whatsapp://send?text=https://example.com" data-action="share/whatsapp/share">
</a>

我的问题是,在 HTML 中,是否有一种优雅的方式来隐藏上述功能,以防用户的 phone 上没有 Whatsapp?如果没有,是否还有一种方法可以在用户没有 Whatsapp 的情况下显示优雅的错误?

哈桑,

这里已经有人问过类似的问题。 How to check if an app is installed from a web-page on an iPhone?

简短:没有合适的方法从浏览器检查是否安装了应用程序。不过有一个 work-around。请检查上面的link。