You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by Saju Thankathurai <sa...@gmail.com> on 2016/02/29 04:12:54 UTC

Browser close event

​Hi,

Is there a good way to handle browser close event in Flex? I need to fire a
remote call to unlock a resource when user closes the browser.

--
Saju​

Re: Browser close event

Posted by Alain Ekambi <ja...@gmail.com>.
What if the browser crashes or the user turns off the device ? Releasing
critical resources on window close or unload is not a good design. What
about a server side session ?
On 29 Feb 2016 05:27, "Saju Thankathurai" <sa...@gmail.com> wrote:

> ​Hi,
>
> Is there a good way to handle browser close event in Flex? I need to fire a
> remote call to unlock a resource when user closes the browser.
>
> --
> Saju​
>

RE: Browser close event

Posted by "Schwarz, Robert" <Ro...@westernasset.com>.
I use this in my template file, but only works for IE. 

    <body scroll="no">
		<script language="JavaScript" type="text/javascript">
		<!--
		var logoutInProgress = false;
		window.onbeforeunload = confirmPageUnload;
	   	 // -->    
	               </script>	


Alternatively, I setup of a session watchdog on the server side that keeps track of new subscriptions, drop-offs, logout events, etc.
When the client stops polling for x seconds, I kill their session, and release their resources.

        <channel-definition id="my-polling-amf" class="mx.messaging.channels.AMFChannel">
            <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amfpolling" class="my.class.TimedAMFEndpoint"/>
            <properties>
                <polling-enabled>true</polling-enabled>
                <polling-interval-millis>500</polling-interval-millis>
                <piggybacking-enabled>false</piggybacking-enabled>
            </properties>
        </channel-definition>

    public void invalidateClientSession(String uniqueClientId)
    {
        FlexSession flexSession = FlexContext.getFlexSession();
        flexSession.removeAttribute("authUser");
        flexSession.invalidate();
        log.info("Session for " + uniqueClientId + " has been invalidated!");
    }

-----Original Message-----
From: Marcus Fritze [mailto:marcus.fritze@googlemail.com] 
Sent: Monday, February 29, 2016 2:16 AM
To: users@flex.apache.org
Subject: Re: Browser close event

Hi,

you should use ExternalInterface and use a javascript event that kicks in, when the  browser will be closed

maybe window.onbeforeunload

Marcus

> Am 29.02.2016 um 04:12 schrieb Saju Thankathurai <sa...@gmail.com>:
> 
> ​Hi,
> 
> Is there a good way to handle browser close event in Flex? I need to fire a
> remote call to unlock a resource when user closes the browser.
> 
> --
> Saju​


********************************************************************** 
E-mail sent through the Internet is not secure. Western Asset therefore recommends that you do not send any confidential or sensitive information to us via electronic mail, including social security numbers, account numbers, or personal identification numbers. Delivery, and or timely delivery of Internet mail is not guaranteed. Western Asset therefore recommends that you do not send time sensitive or action-oriented messages to us via electronic mail. **********************************************************************   

Re: Browser close event

Posted by After24 <vi...@after24.net>.
Same here, using javascript is not a reliable technique.

We manage concurrent access on our application by calling a "I'm still
active" method on the server at constant interval.

Vincent.



--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Browser-close-event-tp12080p12084.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: Browser close event

Posted by Paul Hastings <pa...@gmail.com>.
On 2/29/2016 5:15 PM, Marcus Fritze wrote:
> you should use ExternalInterface and use a javascript event that kicks in, when the  browser will be closed
>
> maybe window.onbeforeunload

never been able to make anything work consistently except sending "heartbeats" 
to the server & let it clean up when the client has a "heart attack".


Re: Browser close event

Posted by Marcus Fritze <ma...@googlemail.com>.
Hi,

you should use ExternalInterface and use a javascript event that kicks in, when the  browser will be closed

maybe window.onbeforeunload

Marcus

> Am 29.02.2016 um 04:12 schrieb Saju Thankathurai <sa...@gmail.com>:
> 
> ​Hi,
> 
> Is there a good way to handle browser close event in Flex? I need to fire a
> remote call to unlock a resource when user closes the browser.
> 
> --
> Saju​