-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy path404.html
30 lines (26 loc) · 1.22 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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>404</title>
<script>
const segment = 1;
//Gets the relative path and the hash of the URL.
//sessionStorage.redirect = '/' + location.pathname.slice(1).split('/').slice(segment).join('/');
sessionStorage.redirect = location.pathname.split('/').slice(0, 1 + segment).join('/');
sessionStorage.hash = location.hash;
console.log('SessionStorage', sessionStorage);
console.log('Location', location);
//Forces the navigation back to the main page, since it's the only entry point that works.
//location.replace(location.pathname.split('/').slice(0, 1 + segment).join('/'));
location.replace('/' + location.pathname.slice(1).split('/').slice(segment).join('/'));
console.log('Location 2:', location);
</script>
</head>
<body>
</body>
</html>