glenelkins Posted November 13, 2006 Share Posted November 13, 2006 HiSimple question, how can I run a function (I.e $user_obj->UserLogout($nickname)) when the browser window closes? Link to comment https://forums.phpfreaks.com/topic/27077-run-php-on-window-close/ Share on other sites More sharing options...
joquius Posted November 13, 2006 Share Posted November 13, 2006 Use javascript onClose event to direct you to another page which closes itself (php first, then JS) or use AJAX.Remember PHP is oblivious to what you do inside your browser after the page has loaded Link to comment https://forums.phpfreaks.com/topic/27077-run-php-on-window-close/#findComment-123831 Share on other sites More sharing options...
Jenk Posted November 13, 2006 Share Posted November 13, 2006 There is no guaranteed way to perform this functionality. Link to comment https://forums.phpfreaks.com/topic/27077-run-php-on-window-close/#findComment-123865 Share on other sites More sharing options...
obsidian Posted November 13, 2006 Share Posted November 13, 2006 [quote author=Jenk link=topic=114794.msg467223#msg467223 date=1163418329]There is no guaranteed way to perform this functionality.[/quote]Agreed. While you could attempt to send an Http request when the window is closed, there are any number of ways why this may not work. There are only certain ways that you can be guaranteed that an onClose event would even fire, and those will only happen for visitors with javascript enabled in the first place. Link to comment https://forums.phpfreaks.com/topic/27077-run-php-on-window-close/#findComment-123899 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.