-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
45 lines (41 loc) · 1.31 KB
/
index.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
<!DOCTYPE html>
<html>
<head>
<title>Redirecting...</title>
<script>
function getCookie(name) {
const cookies = document.cookie.split(';');
for (let cookie of cookies) {
const [key, value] = cookie.trim().split('=');
if (key === name) return decodeURIComponent(value);
}
return null;
}
function isMobile() {
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
}
function redirect() {
const preferredVersion = getCookie('preferred_version');
const isMobileDevice = isMobile();
const screenWidth = window.innerWidth;
if (preferredVersion) {
window.location.href = `/${preferredVersion}/index.html`;
} else if (isMobileDevice) {
window.location.href = '/m/index.html';
} else {
window.location.href = '/d/index.html';
}
}
redirect();
</script>
</head>
<body>
<noscript>
<h2>请启用JavaScript以获取最佳体验</h2>
<p>
<a href="/d/index.html">访问桌面版</a> |
<a href="/m/index.html">访问移动版</a>
</p>
</noscript>
</body>
</html>