Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 686
Pavan Vamsi Avatar asked Feb 16 '15 12:02

Pavan Vamsi


2 Answers

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

  • I'm an iPhone developer, how can I integrate WhatsApp into my app?
  • I'm an Android developer, how can I integrate WhatsApp with my app?

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>
like image 111
Patrick Rudolph Avatar answered Oct 14 '22 17:10

Patrick Rudolph


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/

like image 29
tanguy_k Avatar answered Oct 14 '22 17:10

tanguy_k