how to detect the page has refreshed??

M

Matt

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()">
 
R

Richard Cornford

Matt said:
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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top