I was wondering if there was a way using JavaScript to redirect a user based on their timezone?
Like if timezone is between gmt-12 and gmt-8 redirect to page1.htm for example.
I was looking at getTimezoneOffset() but I don't know how to make it redirect based on the result.
Thanks.
You could use window.location:
var date = new Date(),
offset = date.getTimezoneOffset();
if (offset <= 720 && offset >= 960) {
window.location.href = 'page1.htm';
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With