-
1. Re: Event on exit browser and end conversation
nickarls Mar 25, 2008 8:29 AM (in response to cremersstijn)You could use a (possible browser specific) javascript hook when the page unloads that does a remoting call.
There are separate events org.jboss.seam.conversationTimeout and org.jboss.seam.conversationEnd. I think the end-version is called only on explicit ending of the conversation. Idling leads to the timeout-version and eventually to a org.jboss.seam.pre/postDestroyContext.SESSION
-
2. Re: Event on exit browser and end conversation
cremersstijn Mar 25, 2008 9:14 AM (in response to cremersstijn)
Nicklas Karlsson wrote on Mar 25, 2008 08:29 AM:
You could use a (possible browser specific) javascript hook when the page unloads that does a remoting call.how can you do this?
I'm using richfaces, but how can you for example on a
body tag (which isn't a jsf tag) hang a remote call, i used to do this with a4j:support but this won't work on a not jsf-tag like body.Greetz
-
3. Re: Event on exit browser and end conversation
nickarls Mar 25, 2008 9:31 AM (in response to cremersstijn)Something like
<script language="JavaScript"> window.onbeforeunload = doRemoteCall; function doRemoteCall() { // do the seam remote call } </script>
Of course all the general remoting stuff applies regarding setup and calls.
-
4. Re: Event on exit browser and end conversation
cremersstijn Mar 25, 2008 11:20 AM (in response to cremersstijn)I have tried it this way:
@Observer("org.jboss.seam.conversationTimeout") public void conversationTimeout(){ log.info("conversation timeout"); }
But it won't work :(.
-
5. Re: Event on exit browser and end conversation
cremersstijn Mar 25, 2008 3:16 PM (in response to cremersstijn)I've openened a new forum topic with a clearer title:
http://seamframework.org/Community/ConversationTimeout
-
6. Re: Event on exit browser and end conversation
jacob.orshalick Mar 25, 2008 3:21 PM (in response to cremersstijn)Look at the details of conversationTimeout. The conversationTimeout only occurs for your conversation if a foreground conversation is accessed, your conversation is background, and the conversation-timeout period has elapsed since last access of your background conversation.
-
7. Re: Event on exit browser and end conversation
mail.micke Mar 25, 2008 4:51 PM (in response to cremersstijn)Have a look at the a4j:jsFunction tag from RichFaces, with that you should be able to do what you want. Combine that with the suggestion from Nicklas.
good luck
-
8. Re: Event on exit browser and end conversation
cremersstijn Mar 25, 2008 4:57 PM (in response to cremersstijn)Thanks for your reply, but i think it impossible to call an event when some really leaves the website, because the unload event on the body is called many times during the application flow.
I'm trying to use a timeout instead, unless you have a wonderfull script for this event?
greetz
-
9. Re: Event on exit browser and end conversation
mail.micke Mar 25, 2008 5:26 PM (in response to cremersstijn)Hi
No wonderful script I'm afraid, but I googled this a couple of weeks ago out of curiosity and found things like this:
http://www.codingforums.com/showthread.php?t=37279
Seems like hacks are used to determine where the mouse is, or something similar.
Never tried any of it but it would be really interesting to know if you have any luck with this :)Cheers,
Micke