472,956 Members | 2,563 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,956 software developers and data experts.

Window close event

This is brobably a newbie question but is there anyway to actually stop a
windows close event and stop a user from exiting a page the wrong way.

I know you can use the onbeforeUnload to display a message buy is there
anyway of completely stopping a user from closing a window.

Thanks,

Tony.
Jul 23 '05 #1
2 2072
Tony Clarke wrote:
This is brobably a newbie question but is there anyway to actually stop a
windows close event and stop a user from exiting a page the wrong way.


No.

If there was, then Joe Evil could author a webpage which would consider
_any_ way to leave it as "the wrong way", as it is entirely unacceptable
that people who got a nasty popup should be able to get rid of the hard
core pornography advert in the middle of their screen.

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Jul 23 '05 #2
"David Dorward" <do*****@yahoo.com> wrote in message
news:d2*******************@news.demon.co.uk...
Tony Clarke wrote:
This is brobably a newbie question but is there anyway to actually
stop a
windows close event and stop a user from exiting a page the wrong
way.


No.

If there was, then Joe Evil could author a webpage which would
consider
_any_ way to leave it as "the wrong way", as it is entirely
unacceptable
that people who got a nasty popup should be able to get rid of the
hard
core pornography advert in the middle of their screen.


Not only that, but how are you going to prevent me from reaching out and
hitting the power button on my computer using client-side JavaScript?

I'd imagine that having the computer shut down without doing any further
interaction with the Web server would most likely be considered "exiting
a page the wrong way".

Not to mention that http is stateless, which means once I've requested a
resource from the Web server, and that resource has been delivered, as
far as the Web server is concerned I already _have_ "exited the page"
(discounting session management).

Once you understand the stateless nature of http, you stop trying to
control the users' activities (because there is no way you can control
_everything_ they do) and you start writing your server-side code to
deal with _all_ possibilities (user hitting reload, user opening a new
window in the same session, user logging in and never logging out, etc).

--
Grant Wagner <gw*****@agricoreunited.com>
comp.lang.javascript FAQ - http://jibbering.com/faq
Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Tom Szabo | last post by:
Is there an event when that triggers when the window is closing.... I am talking about when the user clicks on the cross on the right top corner of the window!!!
19
by: Darren | last post by:
I have a page that opens a popup window and within the window, some databse info is submitted and the window closes. It then refreshes the original window using window.opener.location.reload(). ...
1
by: Earl Teigrob | last post by:
I did a ton of searching to try and find a simple solution to this issue and finally wrote my own, which I am sharing with everyone. In my searching, I did find a very complete and robust solution at...
2
by: RJN | last post by:
Hi I have a datagrid which has linkbutton as a template column. The Linkbutton is used to open new windows. I can open multiple windows at a time. On close of any of the child windows,(i.e, on...
1
by: RJN | last post by:
Hi I have a pop-up window which has a task menu on its left which are nothing but links to different screens. This window also has a close button. On click of close button I do some server side...
2
by: Tom | last post by:
How is the best way to avoid validation when closing a window? For instance, I have a Windows Forms window which has a validation event for a text box. However, if one enters invalid data in then...
5
by: lindanr | last post by:
In ASP.NET 2005 I have an onblur="window.close()" javascript event in the <body> tag. When I click on the window's scrollbar, the window closes. The same code works fine in ASP.NET 2003. Any...
5
by: jimmy | last post by:
Hi all, I want to capture the event when the browser's close button is clicked in an html page. I tried using the event.ClientX and event.ClientY property in the body unload event, and this...
15
by: Mahernoz | last post by:
Hi Friends, I simply want to print a report by opening a popup, calling the print function and closing the window after the user has printed the report. I have 2 functions.... in c# The...
1
by: dittu | last post by:
How to close the popup window when submitting the form? I have a sample.jsp. In that page one button is there. when button pressed, open popup window contains one "text box" and one " submit...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.