htmlwhatsapp

Open Whatsapp message box on button click on a web page


I have added some logos at the end of my website. I want to open respective apps based on the logos when clicked by users. This menu is shown when the user accesses the site via mobile

How can I open whatsapp message for a particular number when user clicks on it?

For example for email we have mailto and for telephone we have tel

enter image description here


Solution

  • You can use href of this element to

     <a href="whatsapp://send?text=WHATEVER_LINK_OR_TEXT_YOU_WANT_TO_SEND" title="Share on whatsapp">WhatsApp</a>
    

    For a specific number

     href="//api.whatsapp.com/send?phone=91MOBILE_NUMBER&text=WHATEVER_LINK_OR_TEXT_YOU_WANT_TO_SEND"
    

    Please make sure in phone, there is CountryCode 91 for India