Update index.html
This commit is contained in:
parent
9827fb10de
commit
0f5770eac5
1 changed files with 60 additions and 0 deletions
60
index.html
60
index.html
|
|
@ -79,12 +79,70 @@
|
|||
<div class="result" id="ipOutput6">
|
||||
<span class="loading">Je IPv6-adres wordt opgehaald...</span>
|
||||
</div>
|
||||
<div class="result" id="ipOutput6ms">
|
||||
<span class="loading">Je IPv6 latency wordt opgehaald...</span>
|
||||
</div>
|
||||
<div class="result" id="ipOutput4">
|
||||
<span class="loading">Je IPv4-adres wordt opgehaald...</span>
|
||||
</div>
|
||||
<div class="result" id="ipOutput4ms">
|
||||
<span class="loading">Je IPv4 latency wordt opgehaald...</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// Functie om de latency v4 op te halen en weer te geven
|
||||
async function fetch4MS() {
|
||||
const ipOutput4 = document.getElementById('ipOutput4ms');
|
||||
ipOutput4.innerHTML = '<span class="loading">Je IPv4 latency wordt opgehaald...</span>';
|
||||
|
||||
try {
|
||||
const response = await fetch('https://ip-v4.pixelhosting.nl/latency.php');
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP-fout! status: ${response.status}`);
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
|
||||
if (data.latency_ms) {
|
||||
ipOutput4ms.textContent = `Jouw Ipv4 latency is: ${data.latency_ms} MS`;
|
||||
console.log(`Jouw Ipv4 latency is: ${data.latency_ms} MS`)
|
||||
} else {
|
||||
ipOutput4ms.textContent = 'No IPv4 latency found.';
|
||||
}
|
||||
} catch (error) {
|
||||
ipOutput4ms.textContent = 'No IPv4 latency found.';
|
||||
console.error('Foutdetails (IPv4ms):', error);
|
||||
}
|
||||
}
|
||||
|
||||
// Functie om de latency v6 op te halen en weer te geven
|
||||
async function fetch6MS() {
|
||||
const ipOutput6 = document.getElementById('ipOutput6ms');
|
||||
ipOutput6.innerHTML = '<span class="loading">Je IPv6 latency wordt opgehaald...</span>';
|
||||
|
||||
try {
|
||||
const response = await fetch('https://ip-v6.pixelhosting.nl/latency.php');
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP-fout! status: ${response.status}`);
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
|
||||
if (data.latency_ms) {
|
||||
ipOutput6ms.textContent = `Jouw Ipv6 latency is: ${data.latency_ms} MS`;
|
||||
console.log(`Jouw Ipv6 latency is: ${data.latency_ms} MS`)
|
||||
} else {
|
||||
ipOutput6ms.textContent = 'No IPv6 latency found.';
|
||||
}
|
||||
} catch (error) {
|
||||
ipOutput6ms.textContent = 'No IPv6 latency found.';
|
||||
console.error('Foutdetails (IPv6ms):', error);
|
||||
}
|
||||
}
|
||||
|
||||
// Functie om het IPv4-adres op te halen en weer te geven
|
||||
async function fetchIP4Address() {
|
||||
const ipOutput4 = document.getElementById('ipOutput4');
|
||||
|
|
@ -139,6 +197,8 @@ async function fetchIP6Address() {
|
|||
|
||||
// Roep beide functies aan bij het laden van de pagina
|
||||
window.onload = () => {
|
||||
fetch4MS();
|
||||
fetch6MS();
|
||||
fetchIP4Address();
|
||||
fetchIP6Address();
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue