Jump to content


Photo

run script even if browser closed


  • Please log in to reply
3 replies to this topic

#1 trillion

trillion
  • Members
  • PipPipPip
  • Advanced Member
  • 41 posts

Posted 28 September 2006 - 07:52 AM

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.

#2 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 28 September 2006 - 09:43 AM

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.

#3 steveclondon

steveclondon
  • Members
  • PipPipPip
  • Advanced Member
  • 161 posts

Posted 28 September 2006 - 09:55 AM

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.

#4 scottybwoy

scottybwoy
  • Members
  • PipPipPip
  • Advanced Member
  • 532 posts
  • LocationUK

Posted 28 September 2006 - 10:01 AM

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.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users