Window close event

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Tony Clarke

    #1

    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.


  • David Dorward

    #2
    Re: Window close event

    Tony Clarke wrote:
    [color=blue]
    > 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.[/color]

    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

    Comment

    • Grant Wagner

      #3
      Re: Window close event

      "David Dorward" <dorward@yahoo. com> wrote in message
      news:d2pntc$nmt $1$830fa17d@new s.demon.co.uk.. .[color=blue]
      > Tony Clarke wrote:
      >[color=green]
      >> 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.[/color]
      >
      > 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.[/color]

      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 <gwagner@agrico reunited.com>
      comp.lang.javas cript FAQ - http://jibbering.com/faq


      Comment

      Working...