强制清除会话Cookie(firefox,chrome)

问题描述:

某些浏览器(Firefox,Chrome)在关闭时不会清除会话Cookie,如果您设置某种记住我的开关(例如在FF中,转到选项 - >常规 - >当Firefox启动时 - 从上次显示我的窗口和标签页)。这是一个问题为我们的客户(*机构...),而我确实有绝对的控制http服务器,我没有控制浏览器设置。这种情况是 - 它们用于共享计算机帐户,但是他们不应该能够共享网络帐户 - 只需关闭浏览器就可以终止浏览器设置。

Some browsers (Firefox, Chrome) by design doesn't clean session cookies when you close them, if you set some kind of remember me switch (for example in FF go to Options->General->When Firefox starts->Show my windows and tabs from last time). It is a problem for our client (government agency...) while I do have absolute control over http server, I have no control over browser settings. The scenario is - they're used to share computer accounts, however they shouldn't be able to share web accounts - simply closing the browser should kill the session never mind the browser settings.

有一种优雅的方式如何强制执行?

Is there an elegant way how to enforce that ?

目前只有一个解决方案一种死人的开关(改变cookie只活动一分钟(加密的服务器端时间戳),并在每个页面上有javascriptpinger,将20分钟ping每半分钟一些延长会话处理程序在服务器上登录会话应该是20分钟,滑动到期)。

Currently only solution that comes to my mind is some kind of dead man's switch (change cookies to live only for one minute (encrypted server side time stamp), and on every page have javascript "pinger" that will for 20 minutes ping every half minute some "prolong session" handler on the server (login session should be 20 minutes, sliding expiration).

在firefox中,一个简单的设置是require为了防止firefox记住浏览器关闭时的密码:

In firefox a simple setup is require in order to prevent firefox to remember passwords when the browser closed:


  1. 进入设置菜单(右上角)

  2. 选择隐私标签
  3. 将记住历史记录更改为使用自定义设置 li>
  4. 当自定义设置被标记时,更改cookie设置保持直到
    从直到过期到直到我关闭firefox

  1. enter to setup menu (top right)
  2. select "options"
  3. select "privacy" tab
  4. change "history" from "remember history" to "use custom setting" or "never remember"
  5. when "custom setting" is marked, change the cookies settings "keep until" from "until expired" to "until I close firefox"