 |
| ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5 |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the ASP.NET 1.0 and 1.1 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

July 9th, 2004, 04:40 PM
|
|
Authorized User
|
|
Join Date: Jun 2003
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Response To a Javascript - ThnX !
Hi ! :)
I need your help.
I have a log Off buttons that calls a javascript to close the browser:
Page.RegisterStartupScript("Log Off", "<script language='javascript'>javascript:window.close();</script>")
However, b/c it was not created from windows.open, I'm not able to disable or remove the confirmation.
So, is there a way to trap the response in my log off button
Or is there another way to close the browser ?
Thanks in advance !
|
|

July 9th, 2004, 04:44 PM
|
|
Friend of Wrox
|
|
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
|
|
Closing the browser without confirmation:
http://snibworks.com/dhtml/article.php?id=3
Basically this set an opener to the current window, which allows you to close it without confirmation.
HTH,
Snib
<><
|
|

July 9th, 2004, 05:02 PM
|
|
Authorized User
|
|
Join Date: Jun 2003
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thanks Snib, you rock !
Please let me ask another question; it's part of what I'm doing.
If the user doesn't click on my 'Log Off' feature, and clicks on
the 'X' of the browser, is there a method or an event that gets triggered?
I know that you can include in every page:
<body onUnload="somefunction()">
But this is client-side, I need to update my db.
Thanks for your replies !
|
|

July 9th, 2004, 06:24 PM
|
|
Friend of Wrox
|
|
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
|
|
I have encountered this before and usually do this: create the onUnload event handler, which calls a function to open a window which updates your database. The new window then closes.
<body onUnload="openDBWin()">
<script language=javascript>
function openDBWin()
{
window.open('update_db.asp');
}
</script>
__update_db.asp__
<%
'update database here
%>
<script language=javascript>
window.close();
</script>
HTH,
Snib
<><
|
|

July 9th, 2004, 08:25 PM
|
|
Authorized User
|
|
Join Date: Jun 2003
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Cool; just what I was thinking.
Thanks again for your inputs, really appreciate it !
|
|

July 12th, 2004, 12:55 PM
|
|
Authorized User
|
|
Join Date: Jun 2003
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi Snib.
Hope you had a good weekend.
You mentioned that you've encountered this before, so do you know that the fresh (F5) with trigger the javascript?
How did you handle this, if you don't mind answering another question?
Thanks again !
|
|

July 12th, 2004, 02:07 PM
|
|
Friend of Wrox
|
|
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
|
|
I had no way to avoid this behavior.... perhaps the following code will work?
document.onkeydown=function(){handle_key;};
function handle_key()
{
if(event.keyCode==116)return false;
}
Let me know,
Snib
<><
|
|

July 12th, 2004, 03:55 PM
|
|
Authorized User
|
|
Join Date: Jun 2003
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi Snib, thanks for trying to help.
I guess it still executes ONUNLOAD event.
I don't have any more time to work on it, but what I have is good.
Thanks again !
|
|

July 12th, 2004, 04:01 PM
|
|
Friend of Wrox
|
|
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
|
|
OOPS I messed up in the code I posted. Fixed now, try it again.
HTH,
Snib
<><
|
|

July 12th, 2004, 04:07 PM
|
|
Authorized User
|
|
Join Date: Jun 2003
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
huh?
|
|
 |