onbeforeunload to submit a form |
onbeforeunload to submit a form |
butteryak |
Dec 6 2008, 03:46 PM
Post
#1
|
Group: Members Posts: 1 Joined: 6-December 08 Member No.: 7,266 |
Hello.
I"m a bit new to scripting, so I'm looking for a little help. I have a popup window for users who log on to my network, that allows them to log off. Unfortunetly often people forget to logoff, and simply close the window. This is a problem on public computers in our library. I want to modify this code(as simply as possible) to automatically submit the "logout" if they close the browser without hitting "logout" I've been looking at onbeforeunload, and I have managed to incorporate a warning window, but I would really like to have the form submitted automatically without the warning. Not sure if this is possible with this command, or even possible at all.... thanks for any help or suggestions!! heres the form code: <HTML> <HEAD><TITLE>Logout</TITLE></HEAD> <BODY BGCOLOR="#435370">' <DIV ALIGN="center" STYLE="color: #ffffff; font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif; font-size: 11px;"> <B>Click the button below to disconnect</B><P>' <FORM METHOD="POST" ACTION="{$logouturl}">' <INPUT NAME="logout_id" TYPE="hidden" VALUE="{$sessionid}">' <INPUT NAME="logout" TYPE="submit" VALUE="Logout">' </FORM>' </DIV></BODY>' </HTML>' |
Brian Chandler |
Dec 6 2008, 07:47 PM
Post
#2
|
Jocular coder Group: Members Posts: 2,460 Joined: 31-August 06 Member No.: 43 |
Nothing will reliably force a "logout" (or any other) submission. So you need to design your system to cope with people not logging out. Once you have done that, you don't need to worry about the problem above.
|
Lo-Fi Version | Time is now: 23rd April 2024 - 10:56 AM |