tags:

views:

406

answers:

3

How to destroy the session on closing the browser When browser window is closed, session should be terminated. Right now, if I close the window and type the application url, it is allowing me to access application.

A: 

The session cookie stored on the client should not have a lifetime specified - this way the browser just forgets the cookie on the particular domain after you close the window.

This could solve the problem: ini_set('session.cookie_lifetime', 0)

Blagovest Buyukliev
Its working in IE but not in case of firefox.
ASD
+1  A: 

Native php sessions well expire on browser close. As long as you are not modifying the session cookie expiration time you should be fine.

If this is not happening then I am going to guess you are using a framework that is changing the php defaults or your php configuration has been changed.

wlashell
A: 

Fixed.

With below settings "application" session expires during browser close.

Firefox Browser->Tools->Options->General Tab StartUp: When Firefox starts: Show a blank page

Firefox Browser->Tools->Options->Privacy Tab History: Firefox will Use custom settings for history / Never remember history Cookie: Keep Until : I close firefox

ASD