By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,317 Members | 1,303 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,317 IT Pros & Developers. It's quick & easy.

Recognize reload and enter command

P: n/a
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
Jul 23 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
my****@yahoo.it wrote:
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?


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
Jul 23 '05 #2

P: n/a
> 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.

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
Jul 23 '05 #3

P: n/a
In article <o_**********************@news4.tin.it>, my****@yahoo.it
wrote:
How can I capture the unload event with javascript?


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>onunload tests</title>
<script type="text/javascript">

function leaving()
{

var newWindow;
newWindow = window.open(
"http://www.yahoo.com",
"debug",
"scrollbars,resizable,location,width=700,height=50 0");

alert("please come back soon.");
}
</script>
</head>
<body onunload="leaving()">
<p>Let's pester the user when leaving our window.
</p>
</body>
</html>
Jul 23 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.