G
Guest
Hi Harry:
I apologize in advance if this is not what you are looking for, but I was
browsing the msdn site for a class and came across your posting and may have
an answer for you.
I use ASP - The following skeleton of code is executed when someone moves
off the current page. It needs some coding to check for navigating away from
your application or just to another page within it, but hopefully this will
be helpful.
Saw this code on a site a while ago and I've been using it ever since to log
out users on my site.
-Andrew
<script language="vbscript">
Function window_onbeforeunload()
Dim myChoice
' Code here to check if page going to is an outside page.
myChoice = Msgbox("You are still logged in. Would you like to log out?" &
vbcr & vbcr & "Click 'Yes' to close your session." & _
vbcr & "Click 'No' to continue but keep your session active." & vbcr & _
"Click 'Cancel' and you will be able to remain by choosing 'Cancel' in the
next message box that appears.", vbyesnocancel, "Logout?")
Select Case myChoice
Case vbyes
' Logout Code Here
Case vbno
'Do Nothing, window will navigate away and session will remain active.
Case vbCancel
window_onbeforeunload = "Click Cancel to remain."
Case Else:
window_onbeforeunload = "Click Cancel to remain."
End Select
End Function
</script>
I apologize in advance if this is not what you are looking for, but I was
browsing the msdn site for a class and came across your posting and may have
an answer for you.
I use ASP - The following skeleton of code is executed when someone moves
off the current page. It needs some coding to check for navigating away from
your application or just to another page within it, but hopefully this will
be helpful.
Saw this code on a site a while ago and I've been using it ever since to log
out users on my site.
-Andrew
<script language="vbscript">
Function window_onbeforeunload()
Dim myChoice
' Code here to check if page going to is an outside page.
myChoice = Msgbox("You are still logged in. Would you like to log out?" &
vbcr & vbcr & "Click 'Yes' to close your session." & _
vbcr & "Click 'No' to continue but keep your session active." & vbcr & _
"Click 'Cancel' and you will be able to remain by choosing 'Cancel' in the
next message box that appears.", vbyesnocancel, "Logout?")
Select Case myChoice
Case vbyes
' Logout Code Here
Case vbno
'Do Nothing, window will navigate away and session will remain active.
Case vbCancel
window_onbeforeunload = "Click Cancel to remain."
Case Else:
window_onbeforeunload = "Click Cancel to remain."
End Select
End Function
</script>