Everybody! This is important. In a few days, these forums will be moving over to using the totally sweet Discourse platform. To ensure this migration happens smoothly with no loss of content, these forums are currently in a read-only mode. I do apologize for the inconvenience.

There is never a good time to turn the forums off for an extended period of time, but I promise the new forums will be a billion times better. I'm pretty sure of it.

See you all on the other side in a few days, and if you have any (non-technical) questions, please e-mail me at kirupa@kirupa.com. For technical questions, try to find a tutorial that corresponds to what you are looking for and post in the comments section of that page.


Results 1 to 8 of 8

Thread: Script that keeps running after browser is shut down

  1. #1

    Script that keeps running after browser is shut down


    I need a script that keeps running if the browser is shut down and I have no idea where to start. Can anyone give me a tip?


  2. #2

    browser close event detection

    Hello ruiganga,

    below are the code... for detecting browser close event it is in javascipt, let me know if you have any problem.

    function logoff()
    alert("hi browser closed now");
    <body onBeforeUnload="logoff();">


  3. #3
    I dont know if this is wht u r looking for but you could use CRON Jobs

  4. #4
    jwilliam's Avatar
    An intellectual carrot!
    Could you expand a little on what your script does?

  5. #5
    I want to make a script that sends messages, like newsletters. And I want it to keep sending even if the window is shut down.

    How can I do that?

  6. #6
    Yes, a cronjob will do...
    AS2 / AS3 / JS / JQUERY / (X)HTML / HTML5 / CSS / CSS3 / PHP

  7. #7

    Yes I have read about that cronjob thing. The only thing I can't understand is how I start the cronjob or stop the cronjob uing PHP. This will be to start sending the messages or STOP sending the messages. That is the only thing I can't do.

    I am using Plesk in my server and it haves a cronjob tab to configure it to start using date/time, but that isn't enough for me...

  8. #8
    jwilliam's Avatar
    An intellectual carrot!
    Do you have shell access? If it were me and I needed to run a php script for an extended period of time, I'd just execute it on the command line like so:

    php -q my_script.php &

    If that's not an option, or you absolutely have to do it through a browser, you could have your web script create a temporary file somewhere like this:

    `touch /tmp/start_script`;
    Then have a cron job that runs every minute or so and have it execute this script:

    if(file_exists("/tmp/start_script")) {
      `php -q my_script.php &`;
    The latter example gives me a bit of a queezy feeling, but if you were careful you might be able to do it safely and securely.

    Hope that helps some...

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Home About kirupa.com Meet the Moderators Advertise

 Link to Us


Copyright 1999 - 2012