jasonc Posted May 24, 2006 Share Posted May 24, 2006 I use firefox and this also happens in IE.I login to my site or any site like yahoomail and if i open a new window and visit the same page i am still logged in.my question is how do i make the sessions only work in the window that started them?Thanks Quote Link to comment https://forums.phpfreaks.com/topic/10339-destroy-sessions-when-window1-close-but-window2-still-open/ Share on other sites More sharing options...
wisewood Posted May 24, 2006 Share Posted May 24, 2006 You could look into using the javascript "onbeforeunload" to initiate an ajax query to a php script which destroys the session data when the user leaves the page, or closes the window.Complicated, but it would do the job. Quote Link to comment https://forums.phpfreaks.com/topic/10339-destroy-sessions-when-window1-close-but-window2-still-open/#findComment-38604 Share on other sites More sharing options...
jasonc Posted May 24, 2006 Author Share Posted May 24, 2006 i have tried to find out how i use ajax, where i get it on the site, not able to see what i do,[!--quoteo(post=376706:date=May 24 2006, 04:30 PM:name=wisewood)--][div class=\'quotetop\']QUOTE(wisewood @ May 24 2006, 04:30 PM) [snapback]376706[/snapback][/div][div class=\'quotemain\'][!--quotec--]You could look into using the javascript "onbeforeunload" to initiate an ajax query to a php script which destroys the session data when the user leaves the page, or closes the window.Complicated, but it would do the job.[/quote] Quote Link to comment https://forums.phpfreaks.com/topic/10339-destroy-sessions-when-window1-close-but-window2-still-open/#findComment-38648 Share on other sites More sharing options...
wisewood Posted May 25, 2006 Share Posted May 25, 2006 I will try and find some time later to put together a very basic sample for you. Quote Link to comment https://forums.phpfreaks.com/topic/10339-destroy-sessions-when-window1-close-but-window2-still-open/#findComment-38811 Share on other sites More sharing options...
jasonc Posted May 25, 2006 Author Share Posted May 25, 2006 i appreciate it.thank you[!--quoteo(post=376920:date=May 25 2006, 09:07 AM:name=wisewood)--][div class=\'quotetop\']QUOTE(wisewood @ May 25 2006, 09:07 AM) [snapback]376920[/snapback][/div][div class=\'quotemain\'][!--quotec--]I will try and find some time later to put together a very basic sample for you.[/quote] Quote Link to comment https://forums.phpfreaks.com/topic/10339-destroy-sessions-when-window1-close-but-window2-still-open/#findComment-38849 Share on other sites More sharing options...
wisewood Posted May 25, 2006 Share Posted May 25, 2006 Cant find a way to do it so far.I'm trying to use the onUnLoad command but its not working properly. Quote Link to comment https://forums.phpfreaks.com/topic/10339-destroy-sessions-when-window1-close-but-window2-still-open/#findComment-38856 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.