0

Getting callback when user navigates away from your page

asked 2008-12-08 14:25:18 +0800

ansancle gravatar image ansancle
327 9

At one point I had figured this out, but can't find my old code. I need to get a callback whenever the user navigates away from my page - which means going to a different url, closing the browser tab or browser, basically anything. I need to do some cleanup whenever they leave my page. I will keep looking for my old code and post it if I find it, but in the meantime if anyone knows help appreciated.
Thanks+

delete flag offensive retag edit

0 Replies

Sort by ยป oldest newest

answered 2008-12-08 15:02:59 +0800

ansancle gravatar image ansancle
327 9

Found it - use the DesktopCleanup interface. You also need to let ZK know who to call for
this via zk.xml :

public class MyDesktopCleanup implements DesktopCleanup
{
    public void cleanup(Desktop desktop)
    {
           // put your code here to be called when user leaves page
    }

}

And in zk.xml

	
<listener>
    <description>Called when the ZK Desktop is detroyed</description>	
    <listener-class>com.foo.MyDesktopCleanup</listener-class>
</listener>		

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2008-12-08 14:25:18 +0800

Seen: 199 times

Last updated: Dec 08 '08

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More