Firefox 会话 cookie [英] Firefox session cookies

查看:23
本文介绍了Firefox 会话 cookie的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一般来说,当给定一个没有有效期的 cookie 时,现代浏览器会认为这个 cookie 是一个会话 cookie",他们会在浏览会话结束时删除 cookie(通常在浏览器实例关闭时).

Generally speaking, when given a cookie that has no expiration period, modern browsers will consider this cookie to be a 'session cookie', they will remove the cookie at the end of the browsing session (generally when the browser instance closes).

IE、Opera、Safari 和 Chrome 都支持这种行为.

IE, Opera, Safari and Chrome all support this behavior.

然而,firefox(3.0.9 最新版本)似乎没有遵循这个规则,据我所知,当浏览器关闭时,或者当用户注销或重新启动操作系统时,它不会使 cookie 过期..

However firefox (3.0.9 latest proper release) appears not to follow this rule, from what I can tell it doesn't expire the cookies when the browser is closed, or when the user logs off or restarts the OS..

那么,当它们显然无限期地持续时,为什么 Firefox 将它们称为会话 cookie?

So, why does firefox refer to these as session cookies, when they last aparently indefinitely?

有谁知道 Firefox 是如何处理会话 cookie 过期的?

Does anyone know how Firefox handles session cookie expiration?

推荐答案

这显然是设计使然.查看这个 Bugzilla 错误:https://bugzilla.mozilla.org/show_bug.cgi?id=443354

This is apparently by design. Check out this Bugzilla bug: https://bugzilla.mozilla.org/show_bug.cgi?id=443354

Firefox 有一项功能,您可以关闭 Firefox 并提供保存所有标签的功能,然后您恢复浏览器,这些标签又会回来.这就是所谓的会话还原.我没有意识到的是,它也会恢复这些页面的所有会话 cookie!它就像您从未关闭过浏览器一样对待它.

Firefox has a feature where you close Firefox and it offers to save all your tabs, and then you restore the browser and those tabs come back. That's called session restore. What I didn't realize is that it'll also restore all the session cookies for those pages too! It treats it like you had never closed the browser.

这是有道理的,如果您的浏览器崩溃了,您会立即回到原来的位置,但对于习惯于会话 cookie 被清除的网络开发人员来说,这有点令人不安.我有一些几个月前的旧会话 cookie,这些 cookie 是由我总是在选项卡中打开的网站设置的.

This makes sense in the sense that if your browser crashed you get right back to where you were, but is a little disconcerting for web devs used to session cookies getting cleared. I've got some old session cookies from months ago that were set by sites I always have open in tabs.

要对此进行测试,请关闭浏览器中的所有选项卡,然后关闭浏览器并重新启动.我认为在这种情况下应该清除您网站的会话 cookie.否则,您必须关闭会话恢复.

To test this out, close all the tabs in your browser, then close the browser and restart it. I think the session cookies for your site should clear in that case. Otherwise you'd have to turn off session restore.

这篇关于Firefox 会话 cookie的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆