Reputation: 55
I have a relatively easy problem but its causing me a headache. I want to send an sms from a phonegap app running in android.
I am using this code snippet
window.location.href = "sms:12345?body=message \nMessage line 2";
Now this works fine except for one thing. I cant create a new line in the message body. \n has no effect and doesnt even show. I need to have new lines in the message format but unable to do so.
My Regards, Hassan
Upvotes: 0
Views: 967
Reputation: 1472
Since you are passing the message as a URL parameter, you need to URL encode it.
window.location.href = "sms:12345?body=message+%0AMessage+line+2";
Here is a reference on URL encoding.
Upvotes: 3