-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathredirect-koa-cn-apk.html
46 lines (40 loc) · 1.39 KB
/
redirect-koa-cn-apk.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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>重定向地址获取</title>
<script>
const version = '1.0.3'; // 版本号
const targetUrl = 'https://koa-download.kingsgroup.cn/koa.apk';
const redirectDiv = document.getElementById('redirect'); // 使用 getElementById 确保 redirectDiv 存在
// 获取重定向地址
async function getRedirectUrl() {
try {
const response = await fetch(targetUrl, {
method: 'HEAD',
mode: 'no-cors',
});
// 等待 1 秒,确保重定向地址已更新
await new Promise((resolve) => setTimeout(resolve, 1000));
// 获取重定向地址
const redirectUrl = response.headers.get('Location');
// 更新网页显示
if (redirectDiv) {
redirectDiv.textContent = `重定向地址:${redirectUrl}`; // 使用 textContent 避免注入攻击
}
} catch (error) {
if (redirectDiv) {
redirectDiv.textContent = `获取重定向地址失败:${error}`; // 使用 textContent 避免注入攻击
}
}
}
// 页面加载时获取重定向地址
window.onload = getRedirectUrl();
</script>
</head>
<body>
<h1>正在获取重定向地址...</h1>
<div id="redirect"></div>
<p>版本号:${version}</p>
</body>
</html>