SpeedTest Checker Tool
SpeedTest Checker Tool
Download Speed:
0 Mbps
Upload Speed:
0 Mbps
Ping:
0 ms
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: #f0f0f0;
}
.speedtest-container {
width: 90%;
max-width: 600px;
background-color: white;
padding: 20px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
border-radius: 10px;
text-align: center;
}
h1 {
margin-bottom: 20px;
}
.results {
margin: 20px 0;
}
.result-item {
display: flex;
justify-content: space-between;
padding: 10px;
background-color: #f9f9f9;
border-radius: 5px;
margin-bottom: 10px;
font-size: 18px;
}
button {
padding: 10px 20px;
font-size: 16px;
border: none;
border-radius: 5px;
background-color: #4CAF50;
color: white;
cursor: pointer;
}
button:hover {
background-color: #45a049;
}function updateResult(id, value, unit) {
document.getElementById(id).innerText = `${value} ${unit}`;
}
function startSpeedTest() {
const s = new Speedtest();
s.setParameter("telemetry_level", "basic");
s.onupdate = function(data) {
if (data.download !== undefined) updateResult("downloadSpeed", (data.download.bandwidth / 125000).toFixed(2), "Mbps");
if (data.upload !== undefined) updateResult("uploadSpeed", (data.upload.bandwidth / 125000).toFixed(2), "Mbps");
if (data.ping !== undefined) updateResult("ping", data.ping.latency.toFixed(2), "ms");
};
s.onend = function(abortReason) {
if (abortReason) {
alert("Test aborted: " + abortReason);
}
};
s.start();
}
No comments:
Post a Comment