PhoneGap and WhatsApp

不羁的心 提交于 2019-12-03 12:36:43

Add this line to your config.xml

<access origin="whatsapp:*" launch-external="yes" />

Or use the social sharing plugin

https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin

<button onclick="window.plugins.socialsharing.shareViaWhatsApp('Message via WhatsApp', null /* img */, null /* url */, function() {console.log('share ok')}, function(errormsg){alert(errormsg)})">msg via WhatsApp (with errcallback)</button>

First and more important, add this line to your config.xml

<allow-intent href="whatsapp:*" />

after use the code:

<a href="whatsapp://send?text=Hello%20World!">Hello, world!</a>
Vishal
window.location.href = 'whatsapp://send?text=hello world';

this worked for phonegap IOS

window.open("'whatsapp://send?text=hello world'", "_system");

for android.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!