Jump to content

Archived

This topic is now archived and is closed to further replies.

trillion

run script even if browser closed

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.