yup....I had this problem and this is the best way around it....

Put this code in your application.cfm:

<!---If user closes browser end session --->
<cfif IsDefined("Cookie.CFID") AND IsDefined("Cookie.CFTOKEN")>
        <cfset cfid_local = Cookie.CFID>
        <cfset cftoken_local = Cookie.CFTOKEN>
        <cfcookie name="CFID" value="#cfid_local#">
        <cfcookie name="CFTOKEN" value="#cftoken_local#">
</cfif>  

This overwrites the session cookie written by CF (which has an expiry date =
the session timeout in the application.cfm or the session timeout set by the
CFServer) with a cookie with no expiry.  Therefore it expires when ALL
innstances of the browser is closed.  This means (I think!) that if you are
viewing the site in i.e. and you have another instance of i.e. open then you
will need to kill both in order for the session cookie to expire

------------------------------------------------------------------ 
Andrew Ewings
Project Manager
Thoughtbubble Ltd 
http://www.thoughtbubble.net 
------------------------------------------------------------------ 
United Kingdom 
http://www.thoughtbubble.co.uk/ 
Tel: +44 (0) 20 7387 8890 
------------------------------------------------------------------ 
New Zealand 
http://www.thoughtbubble.co.nz/ 
Tel: +64 (0) 9 488 9131
------------------------------------------------------------------ 
The information in this email and in any attachments is confidential and
intended solely for the attention and use of the named addressee(s). Any
views or opinions presented are solely those of the author and do not
necessarily represent those of Thoughtbubble. This information may be
subject to legal, professional or other privilege and further distribution
of it is strictly prohibited without our authority. If you are not the
intended recipient, you are not authorised to disclose, copy, distribute, or
retain this message. Please notify us on +44 (0)207 387 8890. 



-----Original Message-----
From: Gavin Myers [mailto:[EMAIL PROTECTED]]
Sent: 20 February 2001 15:42
To: CF-Talk
Subject: OT: Killing Sessions on Closed Browser


Hey all,

I need to be able to kill a session/run a script when someone closes their
browser. But I cannot find a javascript command that handles this event
only. All of the commands I have found (onunload etc.) also run when someone
refreshes the page or hits the back arrow.

Has any of you run acrosse this problem? Is there a solution?

Oh, its OT because the web application that is using this is in Java

Thanks!

Gavin
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to