forked from mluvii/customization
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathredirecter.html
156 lines (135 loc) · 4.56 KB
/
redirecter.html
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
<!DOCTYPE html>
<html lang="@ViewBag.PageLanguage">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=EDGE" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">
<style>
html, body, .container {
height: 100%;
margin: 0;
}
.container {
display: flex;
align-items: center;
justify-content: center;
}
#chromeLink {
display: none;
}
#chromeLink.visible {
display: block;
}
#chromeText {
display: none;
}
#chromeText.visible {
display: block;
}
#spinner.invisible{
display: none;
}
#safariText {
display: none;
}
#safariText.visible {
display: block;
}
#winChromeLink {
display: none;
}
#winChromeLink.visible {
display: block;
}
#chromeDiv {
display: none;
text-align: center;
}
#chromeDiv.visible {
display: block;
}
</style>
</head>
<body>
<div class="container">
<span id="spinner" style="color: #868e96;" class="fa fa-spinner fa-spin fa-5x"></span>
<div id="chromeDiv">
<p id="chromeText">We can't guarantee you the best possible experience in this browser. Please use Google Chrome from link below.<br/></p>
<a href="market://details?id=com.android.chrome" id="chromeLink">Download Google Chrome</a>
<a href="https://www.google.com/chrome/" id="winChromeLink">Download Google Chrome</a>
</div>
<p id="safariText">We can't guarantee you the best possible experience in this browser. Please use Safari instead.</p>
</div>
<script type="text/javascript">
var firstUsage = true;
function startWidget(){
var scr = document.createElement('script'); scr.type = 'text/javascript'; scr.async = true; scr.charset = 'UTF-8';
scr.src = '//appchina.mluvii.com/widget/OOWidget.js';
scr.$owidgetOnLoad = function (owidget) {
if (!owidget.isSupported) { return; }
owidget.init("98edd461-b739-4142-a7a8-c7f891cdfb74", "POC");
owidget.connectToServer();
owidget.setStatusUpdateCallback(function(state){
if(firstUsage){
console.log("Good call");
owidget.openAppOnCurrentPage('av');
firstUsage = false;
}
});
}
var ffs = document.getElementsByTagName('script')[0]; ffs.parentNode.insertBefore(scr, ffs);
}
(function () {
var iOS = !!navigator.platform && /iPad|iPhone|iPod/.test(navigator.platform);
navigator.browserSpecs = (function(){
var ua = navigator.userAgent, tem,
M = ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
if(/trident/i.test(M[1])){
tem = /\brv[ :]+(\d+)/g.exec(ua) || [];
return {name:'IE',version:(tem[1] || '')};
}
if(M[1]=== 'Chrome'){
tem = ua.match(/\b(OPR|Edge)\/(\d+)/);
if(tem != null) return {name:tem[1].replace('OPR', 'Opera'),version:tem[2]};
}
M = M[2]? [M[1], M[2]]: [navigator.appName, navigator.appVersion, '-?'];
if((tem = ua.match(/version\/(\d+)/i))!= null)
M.splice(1, 1, tem[1]);
return {name:M[0], version:M[1]};
})();
console.log(navigator.browserSpecs);
var ua = navigator.userAgent.toLowerCase();
var isAndroid = ua.indexOf("android") > -1; //&& ua.indexOf("mobile");
var isChrome = navigator.browserSpecs.name == "Chrome";
var isSafari = navigator.browserSpecs.name == "Safari";
if(isAndroid) {
if(isChrome){
startWidget();
} else{
document.getElementById("chromeLink").className = "visible";
document.getElementById("chromeText").className = "visible";
document.getElementById("chromeDiv").className = "visible";
document.getElementById("spinner").className = "invisible";
}
} else if(iOS){
if(isSafari){
startWidget();
} else{
document.getElementById("safariText").className = "visible";
document.getElementById("spinner").className = "invisible";
}
} else {
if(isChrome){
startWidget();
} else{
document.getElementById("winChromeLink").className = "visible";
document.getElementById("chromeText").className = "visible";
document.getElementById("chromeDiv").className = "visible";
document.getElementById("spinner").className = "invisible";
}
}
})();
</script>
</body>
</html>