How can I calculate internet speed and display to my website?

Is it possible to calculate the internet speed from my ISP and display it on my website? one my client wants to know the speed details to be displayed on top and check it?   Any commercial solutions also welcome.
LVL 36
Loganathan NatarajanLAMP DeveloperAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

You may be interesting in using the free Speed of Me API on your website:
Loganathan NatarajanLAMP DeveloperAuthor Commented:
Thanks, I will check
Use this code if you want to do it on your webserver without an API:
<!DOCTYPE html>

<div id="progress">Please Enable JavaScript</div>

<script type="text/javascript">

var imageAddr = ""; 
var downloadSize = 983040; //bytes

window.onload = function() {
    var oProgress = document.getElementById("progress");
    oProgress.innerHTML = "Calculating Speed. Please Wait...";
    window.setTimeout(MeasureConnectionSpeed, 1);

function MeasureConnectionSpeed() {
    var oProgress = document.getElementById("progress");
    var startTime, endTime;
    var download = new Image();
    download.onload = function () {
        endTime = (new Date()).getTime();
    download.onerror = function (err, msg) {
        oProgress.innerHTML = "Unexpected error.  Please try again later.";
    startTime = (new Date()).getTime();
    var cacheBuster = "?v=" + startTime;
    download.src = imageAddr + cacheBuster;
    function showResults() {
        var duration = (endTime - startTime) / 1000;
        var bitsLoaded = downloadSize * 8;
        var speedBps = (bitsLoaded / duration).toFixed(2);
        var speedKbps = (speedBps / 1024).toFixed(2);
        var speedMbps = (speedKbps / 1024).toFixed(2);
        oProgress.innerHTML = "Your connection speed is: <br />" + 
           speedBps + " bps<br />"   + 
           speedKbps + " kbps<br />" + 
           speedMbps + " Mbps<br />";



Open in new window

Of course you should save the image to your server if you want to test your server speed.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Loganathan NatarajanLAMP DeveloperAuthor Commented:
Thank you, I will do check
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development

From novice to tech pro — start learning today.