Repository navigation
Expand file tree
/
Copy pathindex.html2
More file actions
65 lines (55 loc) · 1.82 KB
/
Copy pathindex.html2
File metadata and controls
65 lines (55 loc) · 1.82 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
<!DOCTYPE html>
<html>
<head>
<title>Base64 Decoder</title>
<style>
body {
white-space: pre-wrap;
font-family: monospace;
}
</style>
</head>
<body>
<script>
// Function to decode Base64
function decodeBase64(encodedString) {
// Check if the browser supports Base64 decoding
if (typeof atob === 'function') {
return atob(encodedString);
} else {
// Fallback implementation for older browsers
var decodedString = '';
var base64Chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
var char1, char2, char3;
var enc1, enc2, enc3, enc4;
var i = 0;
encodedString = encodedString.replace(/[^A-Za-z0-9\+\/\=]/g, '');
do {
enc1 = base64Chars.indexOf(encodedString.charAt(i++));
enc2 = base64Chars.indexOf(encodedString.charAt(i++));
enc3 = base64Chars.indexOf(encodedString.charAt(i++));
enc4 = base64Chars.indexOf(encodedString.charAt(i++));
char1 = (enc1 << 2) | (enc2 >> 4);
char2 = ((enc2 & 15) << 4) | (enc3 >> 2);
char3 = ((enc3 & 3) << 6) | enc4;
decodedString += String.fromCharCode(char1);
if (enc3 != 64) {
decodedString += String.fromCharCode(char2);
}
if (enc4 != 64) {
decodedString += String.fromCharCode(char3);
}
} while (i < encodedString.length);
return decodedString;
}
}
// Get the Base64 string from the URL
var urlParams = new URLSearchParams(window.location.search);
var encodedString = urlParams.get('base64');
// Decode the Base64 string
var decodedString = decodeBase64(encodedString);
// Display the decoded string
document.body.textContent = decodedString;
</script>
</body>
</html>