0

I'm currently developing a website which runs on Firefox.

There is an interceptor in my program to intercept all the requests and judge if the cookie value is log in status or not. If it is not logged in status then redirect to the log in page.

My Firefox is set to "show my windows and tabs from last time" when Firefox starts.

I log in to the website and close the Firefox directly. But when I reopen Firefox, it still has logged in status.

What should I do to avoid the problem?

1 Answers1

0

This topic might give you some insight into the Firefox cookie handling: Firefox session cookies

Also, it is not clearly stated in the question what do you want to achieve. If you are interested in fixing the issue just for yourself, then consider changing the Firefox mode. If you want to fix it for any Firefox-based website user, then consider mentioning the technology you use for creating the website.

UPD: One the one hand,

Not specifying Expires value on the cookie will cause the cookie to be removed when the browser session ends i.e. when user closes the browser.

On the other hand, as it was stated in the post above, Firefox handles cookies in a slightly different way.

For that reason, you could use the short cookies Expires value and update it periodically while user is online.

You may also use unload and onbeforeunload events, which could help you to detect leaving the website by closing tab or going to another address.

The following model is also possible:

On the client side:

once a user opens a new tab, 
    some ID is given to this in js code, 
    and that ID is sent to the server as an ID to create;
once a tab is closed, 
    its ID is sent to server by js code as an ID to remove; 

On the server side:

once a server receives an ID to create,
    it generates a session ID and returns it to a client;
once a server receives an ID to remove,
    it checks, if there are any more tab IDs left,
        if there are some, it just removes a tab ID from an array of those IDs;
        if there are no more, it removes the session and clears its tab IDs array;
Community
  • 1
  • 1
dnl-blkv
  • 2,037
  • 1
  • 17
  • 22
  • Many Thanks.I want to fix it for any Firefox-based website user but have no idea.I also test the stackoverflow website,it comes to log out status when session restore,How was that done? – user3381989 Mar 06 '14 at 05:19
  • Dear @user3381989, please check the update. It may contain some useful information! – dnl-blkv Mar 06 '14 at 15:31
  • To Danek:great,it's very useful!Because of Firefox has the feature of restoring all the session cookies,so I think "use the short cookies Expires value and update it periodically while user is online" will work.Like:set cookie's Max-Age is 1min and update it per 30s. – user3381989 Mar 07 '14 at 17:44