Determine a user's timezone

前端 未结 25 3469
刺人心
刺人心 2020-11-21 07:12

Is there a standard way for a web server to be able to determine a user\'s timezone within a web page?

Perhaps from an HTTP header or part of the user-agent

25条回答
  •  太阳男子
    2020-11-21 07:44

    Don't use the IP address to definitively determine location (and hence timezone)-- that's because with NAT, proxies (increasingly popular), and VPNs, IP addresses do not necessarily realistically reflect the user's actual location, but the location at which the servers implementing those protocols reside.

    Similar to how US area codes are no longer useful for locating a telephone user, given the popularity of number portability.

    IP address and other techniques shown above are useful for suggesting a default that the user can adjust/correct.

提交回复
热议问题