-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path404.html
121 lines (102 loc) · 2.44 KB
/
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
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
<!DOCTYPE html>
<html>
<head>
<title> 8A - Things To Do </title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
<meta http-equiv="Expires" content="-1">
<meta http-equiv="Pragma" content="no-cache">
<link rel="icon" href="icon.svg">
<link rel="apple-touch-icon" href="touch-icon.png">
<style>
body {
font-family: Arial;
background-color: #ffbb54;
margin: 0px;
}
a#link {
display: inline-block;
margin: 10px;
}
div#server_down {
display: none;
width: 100%;
height: 100vh;
box-sizing: border-box;
text-align: center;
justify-content: center;
align-items: center;
}
img {
margin-bottom: 10px;
border-radius: 20px;
}
span.headline {
display: block;
font-weight: bold;
font-size: 20px;
}
a#try_anyway {
display: inline-block;
color: #ffffff;
background-color: #ff6a00;
border-radius: 20px;
text-decoration: none;
margin-top: 20px;
padding: 10px;
padding-left: 20px;
padding-right: 20px;
}
a#try_anyway:hover {
background-color: #ff5400;
}
@media (prefers-color-scheme: dark) {
body {
color: #ffffff;
background-color: #2f2f2f;
}
}
</style>
</head>
<body>
<div id="server_down">
<div>
<img src="touch-icon.png"> <br>
<span class="headline"> The server seems to be offline. </span>
<span> If you think this is an error, please contact me :) </span> <br>
<a id="try_anyway" href="">Redirect anyway ➔</a>
</div>
</div>
<a id="link" href="https://be16-81-5-245-212.eu.ngrok.io"> Redirect not working? Click here. </a>
<script>
var el = document.getElementById('link');
var error_message = document.getElementById('server_down');
var anyway_link = document.getElementById('try_anyway');
var url = el.getAttribute('href');
var new_url = url + window.location.pathname + window.location.search + window.location.hash;
if(serverUp(url)) {
window.location.replace(new_url);
}
else {
anyway_link.href = new_url;
error_message.style.display = "flex";
el.style.display = "none";
}
function serverUp(url) {
var http = new XMLHttpRequest();
http.open('HEAD', url, false);
var success = true;
try {
http.send();
}
catch(exception) {
if(exception.name == 'NetworkError') {
success = false;
}
}
return success;
}
</script>
</body>
</html>