Is their any way of reading a meta tag or some other variable from a web browser that indicates if a connection is using mobile or wifi? I am thinking about on smartphones, tablets e.g. iOS, Android etc?
No. Even if you did, it would be of limited use. If a user had an iPad tethered to their phone via wifi but the phone was on cellular, you’d get a false reading.
The only “number” you could get would be to upload & download a file (the way speedtest.net does it) and collate the results, but that won’t be entirely accurate because of changing conditions on the internet.
I’d suggest optimizing for really slow connections all the time and then everyone’s speed will be good to great!
Keep in mind that WiFi <> Faster in a many cases. I rarely use the WiFi provided in public hotspots as it is generally very slow. I get faster speeds using my LTE iPhone as my own hot spot.
So even if you could there is absolutely zero guarantee that a WiFi connection would be faster than a cellular one.
I just ran a test program wich creates and fetches cookies in a 10 times loop, which should evaluate the time it takes for the signal to go back and forth. Problem is, there is not much difference between a run in the IDE (local), and performances of a CGI accessed from the Internet, or through a 3G phone. I keep getting 181 - 205 microseconds. Somehow I was expecting different results.
You can detect phones, but some of them have a slow connection, and 4G can be faster than DSL, and some are going through WiFi… Impossible to assume a connection speed.
Greg is right : be as fast as you can be, and hope…
Yeah, I just wondered if the mobile / operating system developers had come up with something clever that they were passing to the web apps but looks like nothing yet. It is so messy to lame to have to code for the worst common denominator all the time. Especially when the device / os will have a good idea of what speed it is getting and could pass this on.
Actually, it’s not so straight forward. Like I stated - LTE can be much faster than a lot of Wi-Fi.
Additionally, speeds can vary DRASTICALLY depending on conditions. So if you connect to an 802.11ac access point and are right next to it, you’ll get phenomenal wireless speeds. However, if you then move to the other side of the building, your signal strength may plummet and you may get just a few Mb/s of speed. Turn Wi-Fi off on the phone then and pick up LTE and get 25 or 30 Mb/sec of speed. But then you get into a dead spot for the local cellular operator and your speeds now drop to a crawl.
So just because you have a fast connection at one point with either type of connection does not guarantee you will have a fast connection in the future.
In addition, just because you have a fast connection between the phone and whatever connecting service is being used, really says nothing about the connection to the internet. You could be on an 802.11ac WiFi connection and have 256kbit DSL. So what good is all that WiFi bandwidth doing for you? Yet your web app would think the speed is good.
And even if you have good internet speed at some point, internet speeds vary across the backbones and all depending on the routes, etc. So you can’t rely on that either.
So bottom line is that you always have to think about what the lowest common denominator is and work from there. If your web app needs to be data intensive, then so be it. Just understand the ramifications of it. My web app will work across the internet but some features are really designed to be LAN based as they are bandwidth intensive. But I don’t disable those features or try to detect them over the internet. The experience of the user is just not as good over the net as over the LAN.
So even if hooks were introduced that would tell you what service is being used for the connection, it really would make little practical difference.
Thanks Jon for the detailed reply.
I have not given up on the idea to test connection speed through events. But I am getting extremely strange results.
To measure the load time for a page, I set a variable to the current microseconds in Open, and display the difference between microseconds and the open variable in the shown event. I am using a page with a 612x792 image in it. Here are the results :
- IDE/Local : 6.34 microseconds
- Browser through WiFi/DSL : 1.47 microseconds
- Mobile browser, 3G connection : 1.47 microseconds
The strange delay in the IDE is constant. Maybe due to the emulation ? The identical results between WiFi and mobile 3G, much shorter, are more surprising.
What is interesting is that the IDE seems to show the worst time response. Hence running a project maybe the best way to judge what may happen in the worst conditions. We got the lowest common denominator right there.
Except that we all have experienced 1 or 2 seconds page response time on web sites. Not to mention the 10 seconds it takes for Paypal to appear on Safari upon launch (it is my default page).
What you are trying to do is an interesting idea but I dont think you will ever get a large enough difference with such a small sample size e.g. the image. The internet is so hit and miss over a small timeframe and this is why the likes of Speedtest use a 10mb or larger file as part of the test to have a good sample to calculate the speed.
The upside of your approach may be that for what I am looking for the number of false positives may be enough that it could actually work. Am interested to see what you achieve.
[quote=88293:@Nathan Wright]What you are trying to do is an interesting idea but I dont think you will ever get a large enough difference with such a small sample size e.g. the image. The internet is so hit and miss over a small timeframe and this is why the likes of Speedtest use a 10mb or larger file as part of the test to have a good sample to calculate the speed.
The upside of your approach may be that for what I am looking for the number of false positives may be enough that it could actually work. Am interested to see what you achieve.[/quote]
I am trying to find a way to assert connection speed without disturbing the browsing experience, as it would happen with a larger file. Hence measuring page load time or cookie creation/read. It would be ridiculous to impose several seconds wait on the user to attempt to speed up display.
Ideally, I would love to be able to download a file in the background and measure the time it takes. But I see no simple way to achieve that.