Recognize reload and enter command

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • myname@yahoo.it

    #1

    Recognize reload and enter command

    How can I understand when auser of the web page pres the reload button
    of the web browaser or when he press enter in the line where the
    internet address is inserted? I'd like capture this event to manage it.

    Thanks,
    Marco
  • Dietmar Meier

    #2
    Re: Recognize reload and enter command

    myname@yahoo.it wrote:
    [color=blue]
    > How can I understand when auser of the web page pres the reload button
    > of the web browaser or when he press enter in the line where the
    > internet address is inserted?[/color]

    You can't distinguish reloading from entering an URL, following a link,
    or closing the browser window. All of these user actions simply cause
    an unload event.

    ciao, dhgm

    Comment

    • myname@yahoo.it

      #3
      Re: Recognize reload and enter command

      > You can't distinguish reloading from entering an URL, following a link,[color=blue]
      > or closing the browser window. All of these user actions simply cause
      > an unload event.
      >[/color]
      Argh!
      In my web page where I use javascript I can see that IE e Mozilla have
      different behaviours!

      How can I capture the unload event with javascript?

      Thank very much,
      Marco

      Comment

      • Robert

        #4
        Re: Recognize reload and enter command

        In article <o_2Ld.789918$3 5.30837360@news 4.tin.it>, myname@yahoo.it
        wrote:
        [color=blue]
        > How can I capture the unload event with javascript?[/color]

        Here is an example html file. I do not recommend pestering the user
        when doing an onunload. New browsers limit what can be down in the
        onunload event.

        Robert

        <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
        <html>
        <head>
        <title>onunlo ad tests</title>
        <script type="text/javascript">

        function leaving()
        {

        var newWindow;
        newWindow = window.open(
        "http://www.yahoo.com",
        "debug",
        "scrollbars,res izable,location ,width=700,heig ht=500");



        alert("please come back soon.");
        }


        </script>
        </head>
        <body onunload="leavi ng()">
        <p>Let's pester the user when leaving our window.
        </p>
        </body>
        </html>

        Comment

        Working...