Ver Código Fonte

唤醒app问题

luyanan 7 anos atrás
pai
commit
6535d9a9f6
1 arquivos alterados com 51 adições e 51 exclusões
  1. 51 51
      js/public/openApp.js

+ 51 - 51
js/public/openApp.js

@ -34,28 +34,39 @@
34 34
            document.addEventListener("WeixinJSBridgeReady", r, !1)
35 35
        }
36 36
    }
37
    function IFiOS(W){//IOS中的操作
38
        if (ifSafari && version >= 9) { // 判断safari版本 如果大于9
39
	        setTimeout(function() {  // 必须要使用settimeout
40
	            var ifr2 = document.createElement("a"); //创建a元素
41
	            ifr2.setAttribute("href", W), 
42
	            ifr2.style.display = "none", 
43
	            document.body.appendChild(ifr2);
44
	            var To = document.createEvent("HTMLEvents"); // 返回新创建的 Event 对象,具有指定的类型。
45
	            To.initEvent("click", !1, !1)// 初始化新事件对象的属性,   
46
	            ifr2.dispatchEvent(To)  // 绑定事件
47
	        }, 0)
48
	    }else{
49
	    	setTimeout(function() {
50
		    	var ifr = document.createElement("iframe");
51
		        ifr.src = oUrl; 
52
		        ifr.style.display = "none"; 
53
		        document.body.appendChild(ifr);
54
		        var Tp = document.createEvent("HTMLEvents"); // 返回新创建的 Event 对象,具有指定的类型。
55
	            Tp.initEvent("click", !1, !1)// 初始化新事件对象的属性,   
56
	            ifr.dispatchEvent(Tp)  // 绑定事件
57
	        }, 0)
37
    function IFAndroid(W){//Android中的操作
38
    	if (ifChrome) { // 如果是chrome
39
	        if (ifAndroid) { //安卓浏览器
40
	            setTimeout(function() {
41
	                window.location.href = W ;
42
	            }, 50)
43
	        }
58 44
	    }
45
    }
46
    function IFiOS(W){//IOS中的操作
47
        if(isiOS){
48
	        if (ifSafari && version >= 9) { // 判断safari版本 如果大于9
49
		        setTimeout(function() {  // 必须要使用settimeout
50
		            var ifr2 = document.createElement("a"); //创建a元素
51
		            ifr2.setAttribute("href", W), 
52
		            ifr2.style.display = "none", 
53
		            document.body.appendChild(ifr2);
54
		            var To = document.createEvent("HTMLEvents"); // 返回新创建的 Event 对象,具有指定的类型。
55
		            To.initEvent("click", !1, !1)// 初始化新事件对象的属性,   
56
		            ifr2.dispatchEvent(To)  // 绑定事件
57
		        }, 0)
58
		    }else{
59
		    	setTimeout(function() {
60
			    	var ifr = document.createElement("iframe");
61
			        ifr.src = W; 
62
			        ifr.style.display = "none"; 
63
			        document.body.appendChild(ifr);
64
			        var Tp = document.createEvent("HTMLEvents"); // 返回新创建的 Event 对象,具有指定的类型。
65
		            Tp.initEvent("click", !1, !1)// 初始化新事件对象的属性,   
66
		            ifr.dispatchEvent(Tp)  // 绑定事件
67
		        }, 0)
68
		    }
69
		}
59 70
    }
60 71
	function isInstalled(this_,flag){
61 72
		var myUrl = {
@ -67,29 +78,19 @@
67 78
		var downUrl=myUrl.download;
68 79
		console.log(oUrl)
69 80
		if (ifWeixin) { // 如果是微信端
70
			if(isiOS){
71
				window.location.href = window.location.href +"&ifOp=1";
72
	       	}else{
73
	       		if (j) {
74
	                window.location.href = oUrl;
75
	            } else {
76
	            	setTimeout(function() {
77
	            		window.location.href = downUrl;
78
	            	},1500)
79
	            }
80
	            return;
81
	       	}
81
			window.location.href = window.location.href +"&ifOp=1";
82
			if (j) {
83
                window.location.href = oUrl;
84
            } else {
85
            	setTimeout(function() {
86
            		window.location.href = downUrl;
87
            	},1500)
88
            }
89
            return;
82 90
        }
83
		if (ifChrome) { // 如果是chrome
84
	        if (ifAndroid) { //安卓浏览器
85
	            setTimeout(function() {
86
	                window.location.href = oUrl 
87
	            }, 50)
88
	        }
89
	    }
90
		if(isiOS){ 
91
			IFiOS(oUrl);
92
		}
91

92
		IFAndroid(oUrl);
93
		IFiOS(oUrl);
93 94
	    
94 95
	    var P = Date.now();
95 96
	    setTimeout(function() {
@ -108,15 +109,14 @@
108 109
	function wcFresh(this_){//刷新页面
109 110
		var ifOp=GetQueryString("ifOp");
110 111
		if(ifOp){
111
			if(ifWeixin){
112
				if(isiOS){//指示浏览器打开
113
					var str=document.createElement("div");
114
					str.setAttribute("class","strCss");
115
				   	document.body.appendChild(str);
116
				}
112
			if(ifWeixin){//指示浏览器打开
113
				var str=document.createElement("div");
114
				str.setAttribute("class","strCss");
115
			   	document.body.appendChild(str);
117 116
			}else{
118
				oUrl="ekexiu://"+this_;
119
				IFiOS(oUrl);
117
				var oUrl2="ekexiu://"+this_;
118
				IFiOS(oUrl2);
119
				IFAndroid(oUrl2);
120 120
			}
121 121
		}
122 122
	}