我正在为 Android 开发一个混合应用程序。我添加了以下代码:
<a href="whatsapp://send data-text=mytext">Send message to WhatsApp</a>
<a href="whatsapp://send?text=Hello%20World!">Hello, world!</a>
但是,当我在手机上单击这些链接时,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))
关于javascript - whatsapp://send?text= 不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48610523/