Re: Script execution after window close

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



in fact....I really need to remove the file ( which will be created for
every access - making a copy from another location ). I can't leave that
file alone for ever in the user disk space! :(

On Sun, Mar 4, 2012 at 9:01 PM, Ashley Sheridan <ash@xxxxxxxxxxxxxxxxxxxx>wrote:

> **
> On Sun, 2012-03-04 at 20:49 +0530, Nibin V M wrote:
>
> Hello,
>
> I need to run a few commands when a user close the browser tab. That is, I
> have a php page ( index.php ) and it will create a temporary file to track
> some stuffs. That temporary file should be removed, when the user close the
> browser tab. Is there any way to achieve this?
>
> Thank you,
>
>
>
> Not reliably. There are events in Javascript that you can use to trigger
> an Ajax call (such as onbeforeunload and onunload) but these work slightly
> differently from browser to browser and may not allow you to execute
> anything on the browser if the user is navigating away from the site or
> closing the tab/window.
>
> Why can't you use the session for this, and allow the session to expire
> after a certain period of inactivity, which would be better than
> reinventing what sounds like session behaviour.
>
>   --
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>
>


-- 
Regards....

Nibin.

http://TechsWare.in

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux