Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Triggering a WhatsApp intent by clicking a browser link

I'm using Chrome to trigger intents by clicking on links in the browser:

<a href="intent://scan/#Intent;scheme=zxing;package=
                        com.google.zxing.client.android;end"> Take a QR code </a>

Works great with the barcode scanner. But is there any way to share an image in the same way for the WhatsApp application?

My guess it that it would look something like this (obviously missing the image here):

intent://send/#Intent;scheme=whatsapp;package=com.whatsapp;
                                            action=android.intent.action.SEND;end

But this only opens up the Google Play store and shows me WhatsApp.

Any ideas?

like image 309
Johan Avatar asked Nov 02 '22 08:11

Johan


1 Answers

you only need to use this.

<a href="whatsapp://send?text=<<HERE GOES THE URL ENCODED TEXT YOU WANT TO SHARE>>" data-action="share/whatsapp/share">Share via Whatsapp</a>
like image 83
mayank Avatar answered Nov 08 '22 04:11

mayank