confirm closing web page

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

    confirm closing web page

    I've this problem.
    I need, when the user close the web page, to show a message of confirm with
    Ok and cancel.
    With the event unload when I click cancel the web page closes however.
    What can I do ?
    Sorry for the bad English.
    Hello.


  • Fabrizio

    #2
    Re: confirm closing web page

    I found,
    thanks

    <SCRIPT LANGUAGE="JavaS cript" EVENT="onbefore unload()" FOR="window">
    event.returnVal ue = "Chiudi questa finestra ! Sei sicuro?";
    </SCRIPT>


    "Fabrizio" <fabrizio.cresp i@atenait.it> ha scritto nel messaggio
    news:7qzQa.1739 96$lK4.4928413@ twister1.libero .it...[color=blue]
    > I've this problem.
    > I need, when the user close the web page, to show a message of confirm[/color]
    with[color=blue]
    > Ok and cancel.
    > With the event unload when I click cancel the web page closes however.
    > What can I do ?
    > Sorry for the bad English.
    > Hello.
    >
    >[/color]


    Comment

    • point

      #3
      Re: confirm closing web page

      I think that onbeforeunload( ) event will only work with IE!

      But not sure on that info...anybody! ??

      Respect...

      p.

      "Fabrizio" <fabrizio.cresp i@atenait.it> wrote in message
      news:DNzQa.1734 69$Ny5.4927603@ twister2.libero .it...[color=blue]
      > I found,
      > thanks
      >
      > <SCRIPT LANGUAGE="JavaS cript" EVENT="onbefore unload()" FOR="window">
      > event.returnVal ue = "Chiudi questa finestra ! Sei sicuro?";
      > </SCRIPT>
      >
      >
      > "Fabrizio" <fabrizio.cresp i@atenait.it> ha scritto nel messaggio
      > news:7qzQa.1739 96$lK4.4928413@ twister1.libero .it...[color=green]
      > > I've this problem.
      > > I need, when the user close the web page, to show a message of confirm[/color]
      > with[color=green]
      > > Ok and cancel.
      > > With the event unload when I click cancel the web page closes however.
      > > What can I do ?
      > > Sorry for the bad English.
      > > Hello.
      > >
      > >[/color]
      >
      >[/color]


      Comment

      • ManoDestra

        #4
        Re: confirm closing web page

        If you want to manually control the close via a link on your page then just
        write a function that will do that.

        function confirmClose() {
        if (confirm("Are you sure that you want to close this window?")) {
        top.close();
        //or self.close();
        }
        }

        If you want to capture a user clicking on the close icon in the top right of
        a browser such as IE or NetScape, then I don't know how you would capture
        this via JavaScript.

        Peter.
        "point" <info@caanprodu ction.com> wrote in message
        news:beunjq013p p@enews2.newsgu y.com...[color=blue]
        > I think that onbeforeunload( ) event will only work with IE!
        >
        > But not sure on that info...anybody! ??
        >
        > Respect...
        >
        > p.
        >
        > "Fabrizio" <fabrizio.cresp i@atenait.it> wrote in message
        > news:DNzQa.1734 69$Ny5.4927603@ twister2.libero .it...[color=green]
        > > I found,
        > > thanks
        > >
        > > <SCRIPT LANGUAGE="JavaS cript" EVENT="onbefore unload()" FOR="window">
        > > event.returnVal ue = "Chiudi questa finestra ! Sei sicuro?";
        > > </SCRIPT>
        > >
        > >
        > > "Fabrizio" <fabrizio.cresp i@atenait.it> ha scritto nel messaggio
        > > news:7qzQa.1739 96$lK4.4928413@ twister1.libero .it...[color=darkred]
        > > > I've this problem.
        > > > I need, when the user close the web page, to show a message of confirm[/color]
        > > with[color=darkred]
        > > > Ok and cancel.
        > > > With the event unload when I click cancel the web page closes however.
        > > > What can I do ?
        > > > Sorry for the bad English.
        > > > Hello.
        > > >
        > > >[/color]
        > >
        > >[/color]
        >
        >[/color]


        Comment

        • HikksNotAtHome

          #5
          Re: confirm closing web page

          In article <lU%Sa.3050$D67 .347721@newsfep 1-win.server.ntli .net>, "ManoDestra "
          <manodestra.sof tware@ntlworld. com> writes:
          [color=blue]
          >If you want to capture a user clicking on the close icon in the top right of
          >a browser such as IE or NetScape, then I don't know how you would capture
          >this via JavaScript.[/color]

          Post
          Top
          Dont
          Please

          You can't detect how I left a page other than your mentioned script. Other than
          that, you have no way of knowing if I closed the browser, clicked a favorite,
          typed a URL in, only that I left.
          --
          Randy
          All code posted is dependent upon the viewing browser
          supporting the methods called, and Javascript being enabled.

          Comment

          Working...