Blame view

more/self/js/vipback.js 1.11 KB
313ce84a   songchongxian   创建h5 app项目
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
  //app点击返回按钮调用该函数
  function vipback(){
  	var s = mUrl.getApporWX();
  	console.log("调用返回函数   "+s);
  	if(s=='android'){
  		JSInterface.Vback();
  	}else if(s=='ios'){
  		window.webkit.messageHandlers.Vback.postMessage(null);
  	}else if(s=='wx'){
  		var src = document.referrer;
  		if(src&&src.length>5){
  			window.history.go(-1);
  		}else{
  			if(typeof(WeixinJSBridge)!="undefined"){
  	        	WeixinJSBridge.call('closeWindow');
  	        }else{
  	            if (navigator.userAgent.indexOf("MSIE") > 0) {  
  	                if (navigator.userAgent.indexOf("MSIE 6.0") > 0) {
  	                    window.opener = null; window.close();  
  	                }  
  	                else {  
  	                    window.open('', '_top'); window.top.close();  
  	                }  
  	            }  
  	            else if (navigator.userAgent.indexOf("Firefox") > 0) {  
  	                window.location.href = 'about:blank ';  
  	            }  
  	            else {  
  	                window.opener = null;   
  	                window.open('', '_self', '');  
  	                window.close();  
  	            }
  	        }
  		}
  	}
  }