浏览器后退按钮 - 它会删除会话数据吗?

发布于 2024-07-08 11:08:27 字数 41 浏览 5 评论 0原文

在网络浏览器中点击后退按钮是否会导致先前调用中设置的会话数据被删除?

Does hitting the back button in a web browser cause the session data set in the preceding call to be deleted?

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

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

发布评论

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

评论(3

以酷 2024-07-15 11:08:27

不,不是的。

那么,如果用户通过 POST(而不是 GET)到达上一页并重新发布该页面,服务器将再次处理该请求。 但它不会删除会话中的数据。 可以使用一些代码来实现此行为,但这不是默认情况下的工作方式。

No, it does not.

Well, if the user arrived to the previous page by POST (as opposed to GET) and reposts the page, the server is going to process the request again. It won't delete the data in the session though. It is possible to achieve this behaviour with some code, but that's not how it works by default.

┼── 2024-07-15 11:08:27

服务器端会话数据由 Web 框架处理,因此行为可能有所不同。 然而,几乎所有框架都将会话数据映射到 cookie,这些数据在使用后退按钮时不会丢失。

然而,某些框架可能会在 URL 中而不是在 Cookie 中对会话 ID 进行编码(如果浏览器不支持 Cookie,则通常作为后备措施),在这种情况下,如果“退出”,浏览器可能会丢失会话 ID。

Server-side session data is handled by the web framework, so behavior may differ. However almost all frameworks map session data to cookies, which are not lost when using the back button.

Some frameworks may however encode session ID's in URL's rather than in cookies (often as a fall-back if the browsers doesn't support cookies), and in that case the browsers may lose the session id, if it "backs" out.

孤独患者 2024-07-15 11:08:27

不会。它只会导致浏览器再次发送刚刚发送到服务器的内容,或者导致浏览器从其缓存中获取页面,而根本不与服务器交互。

No. It just causes the browser to either send again what it just sent to the server, or it will cause the browser to fetch the page from its cache, without interacting with the server at all.

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