| Posted by Jerry Stuckle on 07/08/07 14:43 
Rami Elomaa wrote:> newbie kirjoitti:
 >> Hi,
 >>
 >> I wonder if it's possible to detect a user (the browser's) timezone
 >> when he/she access my php file? I saw ppl suggesting using javascript
 >> to collect that information. But I wonder if it's possible to do it
 >> without the headache of javascript.
 >
 > Really isn't much of a headache. All you do is add a hidden field and a
 > tiny tiny script snippet. If the field is blank, user is not using
 > javascript so you'll just display it as GMT. To fill the field just use
 > something like this:
 >
 > <input name="timezone" id="timezone" type="hidden" value="" />
 > <script type="text/javascript">
 > document.getElementById('timezone').value = new
 > Date().getTimeZoneOffset(); // this should all be in one line
 > </script>
 >
 > And there you have it, no headache at all.
 >
 
 But that's not doing it in PHP - like he asked.
 
 --
 ==================
 Remove the "x" from my email address
 Jerry Stuckle
 JDS Computer Training Corp.
 jstucklex@attglobal.net
 ==================
 [Back to original message] |