whatsapp://send?text= 不起作用

whatsapp://send?text= Doesn't work

我正在为 android 开发混合应用程序。我添加了以下代码:

<a href="whatsapp://send data-text=mytext">Send message to WhatsApp</a>
<a href="whatsapp://send?text=Hello%20World!">Hello, world!</a>

但是,当我在 phone 上单击这些链接时,whatsapp 不会弹出。你能帮帮我吗?为什么不分享该消息?

提前致谢!

这是您应该使用的URL:

https://api.whatsapp.com/send?phone=15551234567&text=I'm%20interested%20in%20your%20car%20for%20sale

在 JavaScript 中,您必须对文本进行编码,例如

var url='https://api.whatsapp.com/send'
var text='text can contain this char: &'
window.open(url + '?phone=2211227373&text=' encodeURIComponent(text))