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

时间:2019-01-18 10:57:31   收藏:0   阅读:241

给予点击事件,然后调用以下方法即可(我这用的是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;
             }

        }

  

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!