"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