从浏览器获取客户端时区 [英] get client time zone from browser
本文介绍了从浏览器获取客户端时区的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否有可靠的方法从客户端浏览器获取时区?我看到了以下链接,但我想要一个更强大的解决方案.
Is there a reliable way to get a timezone from client browser? I saw the following links but I want a more robust solution.
推荐答案
看看这个仓库 pageloom很有帮助
Look at this repository pageloom it is helpful
下载 jstz.min.js 并添加一个函数到你的 html 页面
download jstz.min.js and add a function to your html page
<script language="javascript">
function getTimezoneName() {
timezone = jstz.determine()
return timezone.name();
}
</script>
并从您的显示标签调用此函数
and call this function from your display tag
这篇关于从浏览器获取客户端时区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文