Button for cell phone call

Asked

Viewed 1,293 times

1

I need a code that helps the visitor of a site (in Wordpress) to make cell phone calls or trigger Whatsapp by clicking a certain button.

Any hint?

2 answers

2

You can use the URL schema whatsapp:// in the attribute href of a hyperlink followed by the message that will be shared. For example:

<a href='whatsapp://send?text=testando 1 2 3'>Compartilhar "testando 123"</a>

If the user has the application installed, it will be initialized allowing to choose a contact next to a text field that allows to edit the message before sending.

As it is not yet possible to access Whatsapp by browser in the same way as it is done on mobile devices - no desktop this URL scheme is unknown - maybe it is interesting to hide this link and display it only on smaller screens:

/**
 * Tamanho somente para ilustrar! Tenha em mente que
 * a instalação do aplicativo não é restrita a smartphones.
 */
@media screen and (max-device-width: 860px)
  .compartilhar-whatsapp {
    display: block
  }
}

Some links in the application FAQ that cites the use of this custom url scheme:

  • It would be interesting if you activated http://web.whatsapp.com when browsing on the desktop

2

You can use the tel:000000000. Ex:

<a href="tel:21912345678">ligar agora</a>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.