I need to reliably determine user's timezone in JavaScript. Majority of the userbase will be on low bandwidth & old browsers so I have to maintain backwards compatibility and keep data transfer to minimum. Ideally I would like to fetch user's timezone only at start of session (I use CAS for login so there is no login page), then send it back to server where I'll be able to store it in database. I have looked in jsTimezoneDetect library as well as various geolocation APIs (to retrieve location/timezone by user's IP) but each has its drawbacks:
- jsTimezoneDetect is not big, but I'd rather not include 5K of extra JS code on all my pages (there is no single login page!)
- Geolocation APIs (such as IPInfoDB) introduce dependency on external services, can be slow, and does not always guarantee me results
What is the simplest way to reliably and efficiently determine user's timezone, and send it back to my JSF app while using minimum bandwidth and browser's resources?