Welcome Guest, Not a member yet? Register   Sign In
Call function when exiting browser?
#1

[eluser]CappY[/eluser]
Is there way user to call function when exiting browser?

More special -> i want all to clear all DB Caches when user close website or exit browser.

And is there way to cache just one or few query ?

$this->db->cache_on();
-- query --
$this->db->cache_off();

?
#2

[eluser]Mareshal[/eluser]
do it using javascript,an send a request to a specific page
#3

[eluser]BrianJM[/eluser]
[quote author="Mareshal" date="1297202692"]do it using javascript,an send a request to a specific page[/quote]

I don't believe this is possible with JavaScript.
#4

[eluser]Eric Barnes[/eluser]
It is possible but not sure if it is reliable across all browsers:
http://www.4guysfromrolla.com/demos/OnBe...dDemo1.htm

Basically use that to then call an ajax method to do your cleaning.
#5

[eluser]BrianJM[/eluser]
[quote author="Eric Barnes" date="1297304074"]It is possible but not sure if it is reliable across all browsers:
http://www.4guysfromrolla.com/demos/OnBe...dDemo1.htm

Basically use that to then call an ajax method to do your cleaning.[/quote]

That method does not distinguish between closing the page and refreshing it. Just something to consider.
#6

[eluser]InsiteFX[/eluser]
Maybe add a Destructor to your class.

See PHP Net

InsiteFX
#7

[eluser]Jaketoolson[/eluser]
I agree with InsideFX - add a destructor to your class.

As a side note, there are ways using Javascript to process data when leaving the page (either going to new page, refreshing, or closing browser). I coded this for a data sensitive project where we had to be certain the user was aware they were leaving/closing the page.




Theme © iAndrew 2016 - Forum software by © MyBB