普通浏览器实现点击打开微信app

Posted yirsion_wang

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了普通浏览器实现点击打开微信app相关的知识,希望对你有一定的参考价值。

给予点击事件,然后调用以下方法即可(我这用的是jq的点击):

$(function() {
		Cz.Alert().success({text: ‘请返回公众号查看充值结果‘});
		$(".alert-btn-cancel").click(function() {
                openwx();
                
		})
})
 function openwx(){

             locatUrl = "weixin://";

             if(/ipad|iphone|mac/i.test(navigator.userAgent)) {

                var ifr =document.createElement("iframe");

                ifr.src = locatUrl;

                ifr.style.display = "none";

                document.body.appendChild(ifr);

             }else{

                window.location.href = locatUrl;
             }

        }

  

以上是关于普通浏览器实现点击打开微信app的主要内容,如果未能解决你的问题,请参考以下文章