SpeedTest Checker Tool
Download Speed: 0 Mbps
Upload Speed: 0 Mbps
Ping: 0 ms
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: Arial, sans-serif;
background: #f2f2f2;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
.container {
background: #ffffff;
border-radius: 10px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
width: 100%;
max-width: 600px;
padding: 20px;
text-align: center;
}
.header h1 {
color: #3498db;
margin-bottom: 20px;
}
.result {
background: #3498db;
padding: 10px;
color: white;
border-radius: 5px;
font-size: 18px;
}
.button-container {
margin-top: 20px;
}
button {
padding: 15px 25px;
background: #3498db;
color: white;
font-size: 18px;
border: none;
border-radius: 5px;
cursor: pointer;
transition: background 0.3s;
}
button:hover {
background: #2980b9;
}
.statistics {
margin-top: 30px;
font-size: 18px;
color: #333;
}
.statistics div {
margin-bottom: 10px;
}
.footer {
margin-top: 20px;
font-size: 14px;
color: #888;
}
footer a {
color: #3498db;
text-decoration: none;
}
footer a:hover {
text-decoration: underline;
}
@media (max-width: 600px) {
.container {
padding: 10px;
}
button {
width: 100%;
padding: 12px;
}
}
// Function to start the speed test
function startTest() {
document.getElementById("result").innerHTML = "Testing Speed...";
document.getElementById("statistics").style.display = "none";
const test = new Speedtest();
test.getBestServer()
.then(() => {
return test.downloadSpeed();
})
.then(download => {
document.getElementById("downloadSpeed").innerText = (download / 1e6).toFixed(2);
return test.uploadSpeed();
})
.then(upload => {
document.getElementById("uploadSpeed").innerText = (upload / 1e6).toFixed(2);
return test.ping();
})
.then(ping => {
document.getElementById("ping").innerText = ping;
document.getElementById("result").innerHTML = "Speed Test Complete";
document.getElementById("statistics").style.display = "block";
})
.catch(err => {
console.error(err);
document.getElementById("result").innerHTML = "Error Testing Speed. Try Again!";
});
}