普通浏览器实现点击打开微信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;
             }

        }

  

posted @ 2019-01-18 10:27  500_Invalid  阅读(1222)  评论(0编辑  收藏  举报