• web唤起whatsapp客户端通过号码联系


    如果安装了whatsapp客户端,只需跳转

    window.location.href = "https://wa.me/号码";

    如果有区号则只需在前面直接加区号,例如加香港区号:

    https://wa.me/852XXXXXXXX
    if (window.navigator.userAgent.match(/(iPhone|iPod|iPad);?/i)) {
           window.location.href = "https://wa.me/号码";
           setTimeout(function () {
                window.location.href = "https://itunes.apple.com/us/app/whatsapp-messenger/id310633997?mt=8";
                window.location.href = "https://itunes.apple.com/us/app/whatsapp-messenger/id310633997?mt=8";
            }, 2000);
        } else if (window.navigator.userAgent.match(/android/i)) {
            window.location.href = "https://wa.me/号码";;
            setTimeout(function () {
                window.location.href = "https://play.google.com/store/apps/details?id=com.whatsapp";
            }, 2000)
        }

    或者可以到 http://www.conversabit.com/wasap.js/ 提供的小插件自动适配

    html:
    <span data-whatsapp="5215585420898">This will be clickable on mobile</span>
    javascript:
    wasap.init()

    插件还能配合vue应用,具体查看官网

  • 相关阅读:
    Spring boot 梳理
    Spring boot 梳理
    Spring boot 梳理
    观察者模式
    设计模式原则
    Spring MVC上传文件
    Spring MVC视图解析器
    Spring MVC中Action使用总结
    Spring MVC控制器
    Java并发 两个线程交替执行和死锁
  • 原文地址:https://www.cnblogs.com/peter-web/p/9213992.html
Copyright © 2020-2023  润新知