-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathredirect.html
More file actions
57 lines (48 loc) · 2.43 KB
/
redirect.html
File metadata and controls
57 lines (48 loc) · 2.43 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Redirect Page</title>
<script>
// Function to extract the value of a specific parameter from the URL
function getParameterByName(name, url) {
if (!url) url = window.location.href;
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, " "));
}
// Function to redirect based on the argument in the URL
function redirectToPage() {
// Get the value of the 'page' parameter from the URL
var pageParam = getParameterByName('to');
// Define the mapping of argument values to corresponding pages
var pageMapping = {
'ELA-slide-research-project-1': 'https://docs.google.com/presentation/d/11DLAy0476V4PEuIZvOvBfPQUgJphgw01LVInDbQPcb4',
'Dont-click-this': 'https://www.youtube.com/watch?v=xvFZjo5PgG0',
'KCC-Group-Project-Original': 'https://docs.google.com/presentation/d/1Uwr7U5kYjdUa8VwOSklYynDKTHfbi9BPwQ9mNTFVLrE'
// Add more mappings as needed
};
// Check if the argument is valid and corresponds to a page
if (pageParam && pageMapping.hasOwnProperty(pageParam)) {
// Redirect to the specified page
window.location.href = pageMapping[pageParam];
//set the manual redirect "click here" link
document.getElementById("manual_redirect").setAttribute("href",pageMapping[pageParam]);
} else {
// Redirect to a default page or display an error message
//Nah, RickRoll Them
window.location.href = 'https://www.youtube.com/watch?v=dQw4w9WgXcQ';
}
}
// Call the redirect function when the page loads
window.onload = redirectToPage;
</script>
</head>
<body>
<p>This is the redirect page. If you are not redirected, <a href="https://www.youtube.com/watch?v=dQw4w9WgXcQ" id="manual_redirect">click here</a> LOL.</p>
</body>
</html>