I wish to tailor a particular website to a low bandwidth version if the client is connected via WWAN (metered) connection or otherwise.
The connection type is important for the site to know if it should provide a rich experience or a bandwidth efficient experience. My desktop runs on a metered connection and in the future, more desktops will be connected via metered cellular networks (including Windows 8 tablet PCs), efficient web-apps should respect that a user might not require high detail assets on a pay-per-byte-connection.
How do I check if the client is connected via WiFi/LAN/WWAN using HTML5/JavaScript?
NOTE : I do not wish to explicitly check for browser headers (which is not really a solution for desktop browsers that can connect to the internet via multiple methods).
You can't. The information on how a client is connected (i.e., which technologies it uses, if it is pay-per-byte or a flatrate) to a server is not public. You might be able to get a trace route (with all problems that are connected to tracing), if that helps you, but that information won't be accessible JavaScript.
What can do with JS is simple bandwith testing. Download a file of known size via XHR, and measure the time that needs.
The pay model of a connection is absolute private data. Neither will it be sent along to servers on the internet, nor is it available to a loaded website. If you need this information to offer the client a custom app, ask the user directly. He will tell you if he wants.
Yet, wait. Latest Chrome and Firefox can be set (user preference) to provide that data on the experimental
navigator.connection
object.Also, for developing Metro apps, Windows offeres such information on the
Windows.Networking.Connectivity
API, see this tutorial.