3 ms·
It might be nice if browsers automatically kept a running estimate of connection speed based on previous page loads, and exposed it to new pages via JavaScript
by comex 11y ago
It might be nice if browsers automatically kept a running estimate of connection speed based on previous page loads, and exposed it to new pages via JavaScript or even as a CSS media query. That way sites could serve their fancy webfonts (and other large assets) to users on fast connections who won't notice the difference, and omit them for slower users without making them wait for the load to time out.
Of course, the speed estimate could be wrong if the bandwidth bottleneck (on either previous sites or the current one) is further than the last mile, especially for e.g. Chinese users whose Internet speeds are drastically slower with international peers than domestic ones. Or alternately if the user is on a mobile connection and is moving quickly between areas with good and poor reception, going on and off Wi-Fi, etc., although in that case the browser could incorporate signal strength data from the OS. Still, on an Internet whose users have wildly varying connection speeds, I think it makes sense to allow leveraging the difference somehow.
- nateberkopec 11y agoHm, you could probably hack something together with the PerformanceTiming API, which makes a lot of these timings available to JavaScript: https://developer.mozilla.org/en-US/docs/Web/API/PerformanceTiming https://developer.mozilla.org/en-US/docs/Web/API/Performance...
- deleted 11y ago[deleted]
- IanCal 11y agoA flip for that might be to move the decision to the client instead. If you could tag up resources that are expensive but not totally necessary and provide alternatives (more than just for images). For the server-side, perhaps you could make use of the quality parameter in the content-type headers to play about?