how to detect the page has refreshed??

Discussion in 'Javascript' started by Matt, Jul 21, 2004.

  1. Matt

    Matt Guest

    When the page is refresh, it will first call window_unload() and
    then call window_load(). The problem is I window_unload() is
    invoked when the user click close button, or right top icon close
    button. I don't want refresh will call window_unload. Any ideas?
    thanks!!

    function window_load()
    {//etc..
    }

    function window_unload()
    {//etc..
    }

    <BODY ONLOAD="window_load()" ONUNLOAD="window_unload()">
     
    Matt, Jul 21, 2004
    #1
    1. Advertising

  2. Matt wrote:
    > When the page is refresh, it will first call window_unload()
    > and then call window_load(). The problem is I window_unload() is
    > invoked when the user click close button, or right top icon
    > close button. I don't want refresh will call window_unload. Any
    > ideas? thanks!!

    <snip>

    You have neglected to say why you want to do this.

    The unload event is called whenever a page is unloaded for any reason
    (except on the browsers that do not bother to call it when the browser
    is closed). The only way of attributing a reason for the unload is when
    it is the direct result of an action initiated within the document
    (navigation, form submission). However, there is an extensive list of
    user actions that will result in a page unloading, including closing
    down the browser and refreshing the page, and no way of knowing which of
    them applies to any given unload.

    Almost any design that called for an interest in the distinction between
    refreshing a page and closing a browser window would be unsuitable for
    use over HTTP (as it is a stateless protocol).

    Richard.
     
    Richard Cornford, Jul 22, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mr. x
    Replies:
    3
    Views:
    10,897
    Daisy
    Sep 3, 2003
  2. Alfons Puig
    Replies:
    0
    Views:
    310
    Alfons Puig
    Aug 28, 2003
  3. abdul bari
    Replies:
    1
    Views:
    466
    Stanley
    Aug 29, 2003
  4. Bill Cohagan
    Replies:
    4
    Views:
    4,187
    Jacob Yang [MSFT]
    Dec 5, 2003
  5. Matt
    Replies:
    4
    Views:
    7,715
Loading...

Share This Page