Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Some way to guess the speed of client connection

I have to do dynamic decision about the contents weight to send to the client based on his/her connection speed.

That is: if the client is using a mobile device with 3G (or slower) connection, I send to him/her a lightweight content. If he/she is using WiFi or faster connection, I send to him/her the complete content.

I tried to measure the time between reloads, sending to the client a header Location: myurl.com (with some info about the client to identify it). This works on desktop browsers and some full mobile browsers (like Obigo), but it doesn't work on mini (proxy) browsers, like Opera Mini or UCWeb. These browsers return the time of connection between my server and the proxy server, not the mobile device.

The same occurs if I try to reload the page with <meta> tag or Javascript document.location.

Is there some way to discover or measure the speed of client connection, or whether he/she is using 3G or WiFi etc., which works on mini browsers (ie, that I can identify a slow connection thru a mini browser)?

like image 784
Sony Santos Avatar asked Jun 09 '11 13:06

Sony Santos


2 Answers

Yes I know the response is DON'T.

The reason I'm reviving this ancient discussion is twofold:

Firstly, technology has changed, what wasn't easy 9 years ago might be now.

Secondly, I have a client with a website dating back over 20 years virtually unchanged. He declined the offer of a (very inexpensive) rewrite because it works and it's very fast. It's only a few pages, content is still relevant (he did ask me to delete the FAX number!) his view was "if it ain't broke don't fix it". It was written in pure HTML for a 640px wide screen in the days of dial-up modem connections. Some still use them The fixed screen width means it's usable on mobile/tablet, especially in landscape mode. It doesn't look too bad on big screen as there's a tiled background.

I ran Google pagespeed checker and it only scored 99% so I tweaked the htaccess file and it now gets 100%. We are mostly spoilt with fast broadband but some rural users get very disappointing speeds. Those guys can't be happy when they reach a multi-megabyte page. I thought maybe I could try an experiment on another site. If I could detect that the user was on a dial-up connection I could see what happens if I served those users a simple light-weight alternative.

like image 107
user25307 Avatar answered Oct 24 '22 05:10

user25307


I think you should not measure the speed or throughput.

A first guess could be the browser of the client. There are many different browsers for computers but they are generally not the same as browsers for mobile devices.

It is easy to check what browser your users are using.

Still you should provide an option to switch between light weight and full content because your guesses could be wrong.

like image 33
ayckoster Avatar answered Oct 24 '22 04:10

ayckoster