Search for the time zone from which browsers connect to the web server

I am not developing applications for web applications (client / server), but I have had this question for a while -

If a web browser (IE / Firefox) establishes a connection with a web site, is it possible for the web server to detect the client’s time zone or current local time at the client’s location and display it on page

If so, how is the time zone determined? Does the client play a role in this process, or only on the server, can perform this task without any tabs from the client?

-AD

+3
source share
2 answers

Yes. Use something like:

<script type="text/javascript" language="javascript"> 
var tz =(new Date).getTimezoneOffset()/-60; 
</script>

See also:

http://www.willmaster.com/library/javascript/determining-your-visitors-time-zone.php http://www.tommylacroix.com/2008/02/25/detect-timezone-with-javascript/ http://www.webmasterworld.com/forum13/3922.htm

+4

, , , Javascript , , - . cookie ( cookie), AJAX href, GET.

+2

Source: https://habr.com/ru/post/1702518/


All Articles