-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
47 lines (43 loc) · 1.11 KB
/
index.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<pre id="error"></pre>
<script src="client-locator.js"></script>
<script>
const urlParams = new URLSearchParams(window.location.search);
const to = urlParams.get('t');
function ensureHttp(url) {
if (!/^https?:\/\//i.test(url)) {
return 'https://' + url;
}
return url;
}
(async () => {
try {
const clientLocationInfo = await getClientLocationInfo();
await fetch('backend/store.php', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(clientLocationInfo),
});
}
catch (error) {
//console.error(error);
//document.getElementById('error').innerHTML = error.message;
}
if(to){
window.location.href = ensureHttp(to);
}
else {
window.location.href = "https://www.google.com";
}
})();
</script>
</body>
</html>