Page 1 of 1

how to detect the user who open the new browser.

Posted: Sat Feb 28, 2004 11:12 am
by tisa
oh...i have a big problem in mozilla browser~~~

i want to know how to detect the user open a new mozilla browser. Becuase i found that no matter u open how many mozilla browsers , its
share the session_id!!!

becasue my program has cookie to save user login name and password, so after user click the logout button, user should be login again unless he/she open the new browser.

now because of the cookie, i can't logout!! so i set the session when user logout..if this session empty, cookie will take the login action, otherwise cookie won't do it. In mozilla browser, it can't work even i close the mozilla browser and open again, the session still here, so the cookie can't take the action..

Thank you very much

I hope all of you know what i mean and problem:
i just want empty the session when user close the mozilla browser, or
detect user open a new browser

Posted: Mon Mar 01, 2004 11:57 am
by Roja
It all depends on how your code handles cookies.

If you set the lifetime of the cookie to 0 (a per-session cookie), then it will last the lifetime of the browser - and any children 'instances' started from that instance.

So for example, lets say you use session cookies (lifetime = 0), and you send me a cookie. That cookie is valid for my browser. If I - from that browser window - open a new window, or open a new tab, that is considered a "child" instance, and is also able to use that cookie.

Once I've closed this browser, and all children, the cookie goes away.

However, you specifically mentioned wanting a logout button - clicking the logout button should set the cookie to all blanks, and a negative lifetime. That will 'clear' the cookie.

You didnt paste any code, so I can't tell from your description if you are setting per-session cookies, clearing the cookies properly, or any number of other questions.

Please, paste some code and we can help you figure out your problem. I use mozilla & firefox on a daily basis, and I assure you - it does handle cookies securely and correctly. The problem is in an assumption you are making, or in the code itself.