-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQRcode.html
More file actions
executable file
·57 lines (54 loc) · 2.2 KB
/
Copy pathQRcode.html
File metadata and controls
executable file
·57 lines (54 loc) · 2.2 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta content="telephone=no" name="format-detection" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0" />
<title>打开或下载应用</title>
<!--<script src="assets/plugins/jquery-1.8.3.min.js" type="text/javascript"></script>-->
</head>
<body>
<a id="vlink" onClick="try_to_open_app()" style="display:none"></a>
<script>
var browser={
versions:function(){
var u = navigator.userAgent, app = navigator.appVersion;
return {
trident: u.indexOf('Trident') > -1, //IE内核
presto: u.indexOf('Presto') > -1, //opera内核
webKit: u.indexOf('AppleWebKit') > -1, //苹果、谷歌内核
gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') == -1, //火狐内核
mobile: !!u.match(/AppleWebKit.*Mobile.*/)||!!u.match(/AppleWebKit/), //是否为移动终端
ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端
android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, //android终端或者uc浏览器
iPhone: u.indexOf('iPhone') > -1 || u.indexOf('Mac') > -1, //是否为iPhone或者QQHD浏览器
iPad: u.indexOf('iPad') > -1, //是否iPad
webApp: u.indexOf('Safari') == -1 //是否web应该程序,没有头部与底部
};
}()
}
var iOS_URL = "myapp://www.test.com_uid=123";
var Android_URL = "myapp://www.test.com/openwith?uid=123";
var mtUrl = "http://www.test.com/download";
function open_link() {
window.location=mtUrl;
}
function try_to_open_app() {
setTimeout('open_link()', 500);
}
//IOS
if(browser.versions.iPhone){
document.getElementById("vlink").setAttribute("href",iOS_URL);
document.getElementById("vlink").click();
}
//Android
else if(browser.versions.android){
document.getElementById("vlink").setAttribute("href",Android_URL);
document.getElementById("vlink").click();
}
else{
open_link();
}
</script>
</body>
</html>