【问题标题】:How to add "Share on whatsapp" button on mobile website for iOS如何在 iOS 移动网站上添加“在 whatsapp 上分享”按钮
【发布时间】:2015-04-16 23:30:42
【问题描述】:

在网站上添加 whatsapp 分享按钮,适用于 iOS8。 我正在使用以下内容:

<spanid="whatsapp_share_android">
    <a href="whatsapp://send?text={{my_meta.og_title.value}} - http://{{ request.get_host }}{{entity.url}}%3Futm_source=whatsapp%26utm_medium=referral" data-action="share/whatsapp/share" onmousedown="_paq.push(['trackEvent','Share on Whatsapp','Mobile','{{request.get_full_path}}']); ga('send', 'event','Share on Whatsapp','Mobile','{{request.get_full_path}}');ga('mobileTracker.send', 'event','Share on Whatsapp','Mobile','{{request.get_full_path}}');"><img src="{{ STATIC_URL }}images/whatsapp_icon.png" /></a>
</span>

它适用于Android,但不适用于iOS

【问题讨论】:

    标签: javascript ios web-applications mobile-website whatsapp


    【解决方案1】:

    根据应用程序集成的 WhatsApp 常见问题解答,您的 URL 方案应该可以工作:

    我假设您的示例代码中括号内的所有内容都将被您的应用程序替换?在span 标签和它的id 属性之间也需要有一个空格。

    如果你在两个平台上用这个简单的例子试试怎么样:

    <a href="whatsapp://send?text=Hello%20World!">Hello, world!</a>
    

    【讨论】:

    • 如何添加描述?
    【解决方案2】:

    截至 2021 年 3 月 1 日,WhatsApp documentation 声明:“通用链接是链接到 WhatsApp 帐户的首选方法。使用 https://wa.me [...]”

    例子:

    const whatsAppURL = `https://wa.me?text=${encodeURIComponent('The message to send')}`;
    

    whatsapp:// 有什么区别? wa.me 适用于桌面和移动设备(因此称为“通用链接”),而 whatsapp:// 仅适用于安装了 WhatsApp 应用程序的移动设备。

    wa.me 甚至可以与 WhatsApp 的网页版一起使用:https://web.whatsapp.com/

    【讨论】:

    • wa.me 适合我,适用于移动设备和桌面设备。
    猜你喜欢
    • 1970-01-01
    • 2013-05-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-11-11
    • 1970-01-01
    • 2015-09-13
    相关资源
    最近更新 更多