天问

微信、支付宝、百度钱包支付关闭窗口

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
$(function(){
            pushHistory();
            window.addEventListener("popstate", function(e) {
                pushHistory();
                var ua = navigator.userAgent.toLowerCase(); 
                if(ua.match(/MicroMessenger/i)=="micromessenger") { 
                     WeixinJSBridge.call('closeWindow');
                } else if(ua.indexOf("alipay")!=-1){ 
                     AlipayJSBridge.call('closeWebview'); 
                }else if(ua.indexOf("baidu")!=-1){ 
                    BLightApp.closeWindow();
                }
                else{
                    window.close();
                }
        }, false);
            function pushHistory() {
                var state = {
                    title: "title",
                    url: "#"
                };
                window.history.pushState(state, "title", "#");
            }
        });
博客地址:http://blog.yoqi.me/?p=1354
扫我捐助哦
喜欢 0

这篇文章还没有评论

发表评论