-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
67 lines (61 loc) · 2.57 KB
/
index.html
File metadata and controls
67 lines (61 loc) · 2.57 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
58
59
60
61
62
63
64
65
66
67
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>App Link Redirect</title>
<script>
function getDeviceType() {
const userAgent = navigator.userAgent.toLowerCase();
if (/android/.test(userAgent)) {
return 'android';
} else if (/iphone|ipad|ipod/.test(userAgent)) {
return 'ios';
} else if (/macintosh|mac os/.test(userAgent)) {
return 'mac';
} else if (/windows/.test(userAgent)) {
return 'windows';
} else {
return 'unknown';
}
}
function redirectToStore() {
const androidPackageName = 'com.everblaze.app.inklink';
const androidStoreLink = 'https://play.google.com/store/apps/details?id=' + androidPackageName;
const iosAppStoreLink = 'https://apps.apple.com/app/6523435335';
const macStoreLink = iosAppStoreLink;
const windowsStoreLink = androidStoreLink;
const appUrlScheme = 'inklink://';
const deviceType = getDeviceType();
let storeRedirectTimeout;
if (deviceType === 'android' || deviceType === 'ios') {
// 앱 설치 확인을 위해 URL 스킴으로 리다이렉트 시도
window.location.href = appUrlScheme;
}
// 타이머를 설정하여 앱이 설치되지 않았을 경우 스토어로 리다이렉트
storeRedirectTimeout = setTimeout(() => {
if (deviceType === 'android') {
window.location.href = androidStoreLink;
} else if (deviceType === 'ios') {
window.location.href = iosAppStoreLink;
} else if (deviceType === 'mac') {
window.location.href = macStoreLink;
} else if (deviceType === 'windows') {
window.location.href = windowsStoreLink;
} else {
alert('현재 기기는 지원되지 않습니다.');
}
}, 1500);
// URL 스킴을 통해 앱이 열렸다면 타이머를 취소
window.addEventListener('visibilitychange', function () {
if (document.hidden) {
clearTimeout(storeRedirectTimeout);
}
});
}
</script>
</head>
<body onload="redirectToStore()">
<h1>Redirecting to the appropriate store...</h1>
</body>
</html>