How to add "Share on whatsapp" button on mobile website for iOS
Asked Answered
A

2

12

Adding whatsapp share button on website, for iOS8. I am using the following:

<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>

It works on android but not on iOS

Acronym answered 16/2, 2015 at 12:43 Comment(0)
C
20

According to the WhatsApp FAQ for app integration, your URL scheme should work:

I assume that everything within brackets in your sample code will be replaced by your app? Also there needs to be a space between the span tag and its id attribute.

How about if you try it with this simple example on both platforms:

<a href="whatsapp://send?text=Hello%20World!">Hello, world!</a>
Carcass answered 19/2, 2015 at 22:50 Comment(1)
how can we add description?Amphibolite
C
7

As of 2021/03/01, WhatsApp documentation states: "Universal links are the preferred method of linking to a WhatsApp account. Use https://wa.me [...]"

Example:

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

What's the difference with whatsapp://? wa.me works on desktop and mobile (hence the term "Universal links") while whatsapp:// only works on mobile with the WhatsApp application installed.

wa.me even works with the web version of WhatsApp: https://web.whatsapp.com/

Cicala answered 1/3, 2021 at 21:58 Comment(1)
wa.me works for me, both for mobile and desktop.Caryl

© 2022 - 2024 — McMap. All rights reserved.