Internet Speed TestInternet Speed TestStart TestTesting… function startSpeedTest() { // URL of a small file for testing speed (adjust URL as needed) const testUrl = ‘https://www.google.com/images/branding/googlelogo/1x/googlelogo_light_color_272x92dp.png’; const startTime = Date.now(); document.getElementById(‘loading’).style.display = ‘block’; document.getElementById(‘result’).textContent = ”; fetch(testUrl, { method: ‘GET’, cache: ‘no-cache’ }) .then(response => response.blob()) .then(blob => { const endTime = Date.now(); const duration = (endTime – startTime) / 1000; // time in seconds const fileSize = blob.size / 1024 / 1024; // file size in MB const speed = (fileSize / duration).toFixed(2); // speed in MB/s document.getElementById(‘loading’).style.display = ‘none’; document.getElementById(‘result’).textContent = `Download Speed: ${speed} MB/s`; }) .catch(error => { document.getElementById(‘loading’).style.display = ‘none’; document.getElementById(‘result’).textContent = ‘Error in speed test. Please try again.’; }); }

Design a site like this with WordPress.com
Get started