I'm trying to add a link that can be shared in WhatsApp:
For example:
"whatsapp://send?text=http://www.example.com/products/women/dresses?sessionid=34567&source=google.com"
But the link that is sent in WhatsApp is truncated from the '&' until the end. (the second parameter)
The same thing happens when I try:
"WhatsApp://send?text=http://www.example.com/prod&ucts/"
(note the '&' in the middle of the word 'prod&ucts') The text after the '&' is truncated.
Any suggestions why this is happening and how can I fix it?
It'll be cutting it off because an '&' denotes a new query string parameter. You can fix it by encoding the string parameter in your URL using the encodeURI JavaScript function. The & character will encode to "%26".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With