Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes HTML, CSS and JavaScript and the fly likes how to access browser refresh button Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "how to access browser refresh button" Watch "how to access browser refresh button" New topic

how to access browser refresh button

Ravi Goli
Ranch Hand

Joined: Feb 13, 2005
Posts: 31
Hi all,

I got to check for the browser refresh action and delete some set cookies.
How to check a click on the browser refresh button in javascript.

I cannot use another custom refresh button.

Thanks much,
Eric Pascarello

Joined: Nov 08, 2001
Posts: 15376
There is no real way to determine if the browser is refreshed.

Ravi Goli
Ranch Hand

Joined: Feb 13, 2005
Posts: 31

Thanks Eric for the reply.

I've seen sources on internet saying that we can disable the Browser Refresh when refresh is tried using F5 key or when tried by selecting the refresh option from the right click on the page.

But couldn't get a source describing how to access the event resulting from a click on Refresh.

I was thinking we could access every event on the page using DOM or javascript.

umh...still hoping to find a way to access the browser refresh event or click.

Else could someone suggest a way to get my cookies deleted only on a page refresh.

Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 60756

There is no event to detect.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Ravi Goli
Ranch Hand

Joined: Feb 13, 2005
Posts: 31
Hi Bear,

Thanks for the reply.

I got the problem I was working on fixed.
I had problem in using the path the correct way for the javascript cookies.
I was able to read a cookie from a page different from the one it was created without specifying the path for it, so while deleting it was not specifying the path, but finally got the deletion working by specifying the path.

Consider Paul's rocket mass heater.
subject: how to access browser refresh button
Similar Threads
Overriding Browser refresh button
Browser Refresh
html form refresh
how to invalidate session when browser refreshed or backward pressed
Disabling Back and Refresh/Reload button.