I am using the following code: (jquery)
window.open("whatsapp://send?text=Hello World!")
To open and share a message from the mobile browser, this documentation can be found here: https://www.whatsapp.com/faq/android/28000012
However, I'd like to add a 'newline' somewhere in the message.
I tried: \n
<br>
<br/>
<br>
in the message but these do not seem to work properly.
\n
\r
only give me a "space" as well as +
<br>
breaks the sentence off.
Anyone that can give me some insight into how I generate a linebreak in the whatsapp message from a (mobile) browser?
Really stuck here!
How to add a line break: I have tried \n , \r\n , PHP_EOL , and %0D%0A , but it just displays as text. Try to use: PHP_EOL instead of \n .
Use https://wa.me/<number> where the <number> is a full phone number in international format. Omit any zeroes, brackets, or dashes when adding the phone number in international format.
Based on the URL scheme I'm pretty sure that %0A is the way to go, you could go as far as %0A%0D...
window.open("whatsapp://send?text=Hello%20World!%0AAnother%20Word")
Most languages will have a method for URL encoding - see this website for an example implementation:
http://meyerweb.com/eric/tools/dencoder/
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