|
Posted by Rami Elomaa on 07/08/07 19:17
Jerry Stuckle kirjoitti:
> 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.
>
No, it isn't, and I realize that. However in his post he wishes to "do
it without the headache of javascript", I simply wanted to show that
it's not that big a deal with javascript as he thinks. Writing one line
of js shouldn't be a headache.
I agree that I was off topic there, and possibly should have directed my
post to a javascript group. My mistake and I apologise for that.
--
Rami.Elomaa@gmail.com
"Wikipedia on vähän niinq internetin raamattu, kukaan ei pohjimmiltaan
usko siihen ja kukaan ei tiedä mikä pitää paikkansa." -- z00ze
Navigation:
[Reply to this message]
|