如何从请求对象获取客户端时间。没有 JavaScript

发布于 2024-12-23 12:34:50 字数 118 浏览 0 评论 0原文

我想在Web应用程序中使用客户端计算机的时间。有没有办法从 HttpServletRequest 获取用户时间?我无法使用任何 JavaScript 或客户端脚本,因为此 Web 应用程序适用于不支持脚本的低端手机。谢谢。

I want to use the time of client machine in Web application. Is there any way to get user time from HttpServletRequest? I can't use any javascript or client side scripting, as this web application is for lower end mobile phones, which do not support scripting. Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

源来凯始玺欢你 2024-12-30 12:34:51

如果您查看客户端发出的原始请求,您会发现通常不会随请求发送客户端时间戳。

这意味着您必须将时间信息添加到客户端的请求中,以使其在服务器端可用。

If you look at the raw request made by the client you will see that in general no client timestamp is sent with the request.

This means that you have to add the time information to your request on the client side to make it available on the server side.

清眉祭 2024-12-30 12:34:50

您所追求的可能是不可能的,如 this< /a> 之前的 SO 线程:

客户端应该只在包含以下内容的消息中发送日期标头字段
实体主体,如 PUT 和 POST 请求的情况,甚至
那么它是可选的。没有时钟的客户端不得发送日期
请求中的标头字段。

What you are after might not be possible, as stated in this previous SO thread:

Clients SHOULD only send a Date header field in messages that include
an entity-body, as in the case of the PUT and POST requests, and even
then it is optional. A client without a clock MUST NOT send a Date
header field in a request.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文