|
 |
asp_web_howto thread: This is how to force user to close window with button
Message #1 by "Alex Shiell, ITS, EC, SE" <alex.shiell@s...> on Thu, 21 Jun 2001 10:55:22 +0100
|
|
This question has come up time and time again on these lists: How do you
force the user to leave your application via a "Log out" button rather than
by closing the window or navigating to a different site. I was just mucking
about for my own interest, and came up with this simple and effective
solution:
Any page of the application:
<HTML>
<HEAD>
<TITLE></TITLE>
<SCRIPT FOR="window" EVENT="onunload">
window.open(document.location.href);
</SCRIPT>
</HEAD>
<BODY>
<INPUT TYPE="button" VALUE="Log out"
ONCLICK="window.onunload='';window.navigate('logout.asp');">
</BODY>
</HTML>
logout.asp:
<% @ language="vbscript" %>
<%
'log out code here
%>
<HTML>
<HEAD>
<TITLE></TITLE>
</HEAD>
<BODY ONLOAD="window.close();">
</BODY>
</HTML>
________________________________________________________________________
Scottish Enterprise Network
http://www.scottish-enterprise.com
Message #2 by "George Draper" <georgedraper@m...> on Thu, 21 Jun 2001 07:17:52 -0400
|
|
That's one of the best solutions I've seen yet, but what if the user
disables javascript?
-----Original Message-----
From: Alex Shiell, ITS, EC, SE <alex.shiell@s...>
To: ASP Web HowTo <asp_web_howto@p...>
Date: Thursday, June 21, 2001 7:05 AM
Subject: [asp_web_howto] This is how to force user to close window with
button
>This question has come up time and time again on these lists: How do you
>force the user to leave your application via a "Log out" button rather than
>by closing the window or navigating to a different site. I was just
mucking
>about for my own interest, and came up with this simple and effective
>solution:
>
>Any page of the application:
><HTML>
><HEAD>
><TITLE></TITLE>
><SCRIPT FOR="window" EVENT="onunload">
> window.open(document.location.href);
></SCRIPT>
></HEAD>
><BODY>
><INPUT TYPE="button" VALUE="Log out"
>ONCLICK="window.onunload='';window.navigate('logout.asp');">
></BODY>
></HTML>
>
>logout.asp:
><% @ language="vbscript" %>
><%
> 'log out code here
>%>
><HTML>
><HEAD>
><TITLE></TITLE>
></HEAD>
><BODY ONLOAD="window.close();">
></BODY>
></HTML>
Message #3 by "Alex Shiell, ITS, EC, SE" <alex.shiell@s...> on Thu, 21 Jun 2001 14:37:23 +0100
|
|
If they were that determined then they could just go into Task Manager
and
kill the process...
-----Original Message-----
From: George Draper [mailto:georgedraper@m...]
Sent: 21 June 2001 12:18
To: ASP Web HowTo
Subject: [asp_web_howto] Re: This is how to force user to close window
with button
That's one of the best solutions I've seen yet, but what if the user
disables javascript?
-----Original Message-----
From: Alex Shiell, ITS, EC, SE <alex.shiell@s...>
To: ASP Web HowTo <asp_web_howto@p...>
Date: Thursday, June 21, 2001 7:05 AM
Subject: [asp_web_howto] This is how to force user to close window with
button
>This question has come up time and time again on these lists: How do
you
>force the user to leave your application via a "Log out" button rather
than
>by closing the window or navigating to a different site. I was just
mucking
>about for my own interest, and came up with this simple and effective
>solution:
>
>Any page of the application:
><HTML>
><HEAD>
><TITLE></TITLE>
><SCRIPT FOR=3D"window" EVENT=3D"onunload">
> window.open(document.location.href);
></SCRIPT>
></HEAD>
><BODY>
><INPUT TYPE=3D"button" VALUE=3D"Log out"
>ONCLICK=3D"window.onunload=3D'';window.navigate('logout.asp');">
></BODY>
></HTML>
>
>logout.asp:
><% @ language=3D"vbscript" %>
><%
> 'log out code here
>%>
><HTML>
><HEAD>
><TITLE></TITLE>
></HEAD>
><BODY ONLOAD=3D"window.close();">
></BODY>
></HTML>
|
|
 |