Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to check if the browser was closed

Status
Not open for further replies.

rewdee

Programmer
Aug 17, 2001
295
US
Good Afternoon All,

This will be for the dhtml gurus or someone with lots of Internet savvy.

I have an asp website that authenticates user's and adds a cookie to validated user's. However, when a user closes the browser the cookie is still valid for 30 minutes (length of cookie). I want to invalidate that cookie. I have a logoff link that does this but if the user just closes the browser, that function is not called.

Is there some way (or event) to find out if the user has closed the browser? Anyone else have any idea how to invalidate a cookie when a user closes the browser?

Thanks,
Rewdee
 
Use sessions. Session cookies are invalid/deleted when the browser closes.
 
How do I use a session cookie? Currently I have some cookie that checks to see if the user has logged in (if not send to login page) but they're set for 30 minutes. I could use those cookies plus another one but would I set it to 2 minutes?

Any help would be appreciated?

Thanks,
Rewdee
 
Ask in ASP forum how to do sessions in ASP. Basically, it is very very simple, you just store variables into Session.Contents.Item rather than cookies.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top