|
Posted by Rami Elomaa on 07/08/07 08:54
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.
--
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]
|