uniapp 从不同的应用程序链接 WhatsApp

h5:
<a href="https://api.whatsapp.com/send?phone=+86123456789&text=Hello">点我WhatsApp聊天</a>
移动端: <a href="whatsapp://send?phone=+86123456789&text=Hello">点我WhatsApp聊天</a> // 这种方式 好像只是Android上起作用
ios上使用如下: //安卓这种方式没办法跳转到指定人的聊天对话框上 可以用上面那种 if (plus.os.name == "Android") { plus.runtime.launchApplication({ pname:"com.whatsapp", // extra:{phone:"+8618312727657",text:"测试内容"}, extra:{phone:"8618312727657"}, },function(e) { alert( "Open system default browser failed: " + e.message ) } ) } else if ( plus.os.name == "iOS" ) { // plus.runtime.launchApplication( {action:"whatsapp://send?phone=8618312727657&text=Hello"}, function ( e ) { // plus.runtime.launchApplication( {action:"https://wa.me/8618312727657?text=I'm%20interested%20in%20your%20car%20for%20sale"}, function ( e ) { plus.runtime.launchApplication( {action:"https://wa.me/8613025532209"}, function ( e ) { alert( "Open system default browser failed: " + e.message ) }) }

  

posted @ 2023-07-17 19:29  多喝热水,早点睡觉  阅读(631)  评论(1编辑  收藏  举报