1
I realized that Whatsapp Web, when forwarding a message via link, for example with the link below, it will cut the character =
:
https://web.whatsapp.com/send?phone=551100000000&text=o%20valor%20é%20=%20100
The same does NOT occur when sharing is done by cell phone, where I use href="Whatsapp://send? text=value = R$ 199,90 - Go to the link: www.bla.bla".
Follow the code I use:
$(function() {
$(".clickWhatsAppChat").click(function() {
var PhoneNumber = "(11) 0000-00000";
PhoneNumber = PhoneNumber.replace("+", "");
PhoneNumber = PhoneNumber.replace(".", "");
PhoneNumber = PhoneNumber.replace(" ", "");
PhoneNumber = PhoneNumber.replace("-", "");
PhoneNumber = PhoneNumber.replace("(", "");
PhoneNumber = PhoneNumber.replace(")", "");
if ($(window).width() < 768) {
var confirma = confirm("Se você tiver o WhatsApp instalado, iniciará uma conversa com " + PhoneNumber + ".");
if (confirma == true) {
window.location.href = "https://api.whatsapp.com/send?phone=55" + PhoneNumber + "&text=valor=R$199,90";
}
} else {
var confirma = confirm("Faça o login no WhatsApp Web e AGUARDE ALGUNS SEGUNDOS até que a coversa com " + PhoneNumber + " se inicie.");
if (confirma == true) {
window.open("https://web.whatsapp.com/send?phone=55" + PhoneNumber + "&text=valor=R$199,90", "_blank");
}
}
});
});
Has anyone experienced the same difficulty? If yes, how to solve?
Namesake, you may need to shrink the string to not conflict with the reserved characters. You can use encodeURIComponent for that reason
– fernandosavio
What do you mean "cut off"?
– Sam
yes, I can do that, but the point is that the mobile link, which directs to the app, does not have this conflict...
– Savio
THE REAL REASON FOR THIS IS SPECIAL CHARACTERS. SPACES AND SOME CHARACTERS ARE NOT SENT. BELIEVE ME. I WENT THROUGH IT AND SOLVED TAKING OUT THE SPACES.
– Risk