trillion Posted September 28, 2006 Share Posted September 28, 2006 How can I get my php script to complete even if the user closes their browser that initiated the script?I don't think I will have command line access but would like to know if that is is only option as I may have to switch hosts. Link to comment https://forums.phpfreaks.com/topic/22351-run-script-even-if-browser-closed/ Share on other sites More sharing options...
wildteen88 Posted September 28, 2006 Share Posted September 28, 2006 This is not possible. PHP doesnt know when the client closes the browser/leaves your site. You might be able to trigger a php script using Ajax when the user closes/leaves. Link to comment https://forums.phpfreaks.com/topic/22351-run-script-even-if-browser-closed/#findComment-100130 Share on other sites More sharing options...
steveclondon Posted September 28, 2006 Share Posted September 28, 2006 I would suggest having a script that would check what ever you need to be finished off on that particular page and run this using crontab. Depending on what you need to do that might be possible, ie for me if users place an ad on one of my sites and then close the browser i have a script that checks emails are sent if not it will send them. Link to comment https://forums.phpfreaks.com/topic/22351-run-script-even-if-browser-closed/#findComment-100140 Share on other sites More sharing options...
scottybwoy Posted September 28, 2006 Share Posted September 28, 2006 Another Idea, is to have the close button ommited off the browser and make your own exit button, so it can process that after its finnished what you wanted it to do. Link to comment https://forums.phpfreaks.com/topic/22351-run-script-even-if-browser-closed/#findComment-100145 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.