Skip to content

Commit 32cef46

Browse files
authored
Download link (#235)
1 parent 6a45ef1 commit 32cef46

2 files changed

Lines changed: 13 additions & 56 deletions

File tree

_downloads/windows/arm64.md

Lines changed: 7 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -28,34 +28,13 @@ Can't download? [Click here to download (alternative)](https://alist.8mi.tech/d/
2828

2929

3030
<script>
31-
async function checkUrl(url) {
32-
try {
33-
const response = await fetch(url, { method: 'HEAD' });
34-
return response.ok;
35-
} catch {
36-
return false;
37-
}
38-
}
39-
40-
async function redirect() {
31+
setTimeout(function() {
4132
const isZhCN = /^zh-CN/i.test(navigator.language);
42-
const url1 = "https://alist.8mi.tech/d/mirror/ms-jdk/Auto/microsoft-jdk-21-windows-aarch64.msi";
43-
const url2 = "https://aka.ms/download-jdk/microsoft-jdk-21-windows-aarch64.msi";
44-
45-
const [url1Available, url2Available] = await Promise.all([
46-
checkUrl(url1),
47-
checkUrl(url2)
48-
]);
49-
50-
if (url1Available && !url2Available) {
51-
window.location.href = url1;
52-
} else if (!url1Available && url2Available) {
53-
window.location.href = url2;
54-
} else {
55-
window.location.href = isZhCN ? url1 : url2;
56-
}
57-
}
58-
59-
setTimeout(redirect, 5000); // Wait 5 seconds
33+
const url = isZhCN
34+
? "https://aka.ms/download-jdk/microsoft-jdk-21-windows-aarch64.msi"
35+
: "https://aka.ms/download-jdk/microsoft-jdk-21-windows-aarch64.msi";
36+
location.href = url;
37+
}, 5000); // Wait 5 seconds
6038
</script>
6139

40+

_downloads/windows/x86_64.md

Lines changed: 6 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -28,34 +28,12 @@ Can't download? [Click here to download (alternative)](https://alist.8mi.tech/d/
2828

2929

3030
<script>
31-
async function checkUrl(url) {
32-
try {
33-
const response = await fetch(url, { method: 'HEAD' });
34-
return response.ok;
35-
} catch {
36-
return false;
37-
}
38-
}
39-
40-
async function redirect() {
31+
setTimeout(function() {
4132
const isZhCN = /^zh-CN/i.test(navigator.language);
42-
const url1 = "https://alist.8mi.tech/d/mirror/ms-jdk/Auto/microsoft-jdk-21-windows-x64.msi";
43-
const url2 = "https://aka.ms/download-jdk/microsoft-jdk-21-windows-x64.msi";
44-
45-
const [url1Available, url2Available] = await Promise.all([
46-
checkUrl(url1),
47-
checkUrl(url2)
48-
]);
49-
50-
if (url1Available && !url2Available) {
51-
window.location.href = url1;
52-
} else if (!url1Available && url2Available) {
53-
window.location.href = url2;
54-
} else {
55-
window.location.href = isZhCN ? url1 : url2;
56-
}
57-
}
58-
59-
setTimeout(redirect, 5000); // Wait 5 seconds
33+
const url = isZhCN
34+
? "https://aka.ms/download-jdk/microsoft-jdk-21-windows-x64.msi"
35+
: "https://aka.ms/download-jdk/microsoft-jdk-21-windows-x64.msi";
36+
window.location.href = url;
37+
}, 5000); // Wait 5 seconds
6038
</script>
6139

0 commit comments

Comments
 (0)