Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

whatsapp://send?text cut string from '&' character till end? [duplicate]

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?

like image 773
BIBI Avatar asked Oct 25 '25 15:10

BIBI


1 Answers

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".

like image 111
DoctorMick Avatar answered Oct 27 '25 05:10

DoctorMick