forked from denny0223/0b.sk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
404.html
30 lines (27 loc) · 909 Bytes
/
404.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
<!DOCTYPE html>
<html>
<head>
<title>URL Shortener</title>
<script>
async function handleRedirect() {
const shortCode = window.location.pathname.slice(1);
const apiUrl = 'https://script.google.com/macros/s/AKfycbwtHzdx2xBkxzJQM4KVFJu6xz_R2W9-T6mM0osJVd5KtlcK-4R58wkA5W26uAYiRRfxNQ/exec?code=' + shortCode;
try {
const response = await fetch(apiUrl);
const result = await response.json();
if (result.status === 'success') {
window.location.href = result.message;
} else {
document.body.innerHTML = 'URL Not Found';
}
} catch (error) {
document.body.innerHTML = 'Redirect Error';
}
}
window.onload = handleRedirect;
</script>
</head>
<body>
Redirecting...
</body>
</html>