This week's book giveaway is in the Java in General forum.
We're giving away four copies of Think Java: How to Think Like a Computer Scientist and have Allen B. Downey & Chris Mayfield on-line!
See this thread for details.
Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Overriding Browser refresh button

 
Pradeep Chandrasekharan Nair
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can any one tell me how to override browser refresh button. actually my need is to submit a form when the browser is refreshed using javascript.

Thanks in Advance

Pradeep
 
Niki Nono
Ranch Hand
Posts: 256
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i feel that you should search google first before posting the question. is much faster for you.
anyways i searched for it and got one link.
enjoy

http://www.htmlgoodies.com/tutorials/getting_started/article.php/3479551#itself
[ February 10, 2006: Message edited by: Niki Nono ]
 
Pradeep Chandrasekharan Nair
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually i was enquiring about overriding the browser refresh button. ie. when i click on the browser refresh button, i need to call a javascript function. is this possible?
 
Christian Gross
Author
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just off the top of my head here... There are the body events preunload, or unload? I know for the State Navigation pattern I used those events to detect when a page was reloaded or URL changed.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can not detect a refresh button clicked. the onunload gets called fro refresh, links click, browser closing, etc so it is really not a good solution. So the answer is, you really can not do it.

Eric
 
Christian Gross
Author
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Though could you not detect a browser refresh with a little help from the server side? This is what I did with the State Navigation pattern. I implemented the onload, and onunload events to pull and push the state of a page.
 
jimmy davids
Greenhorn
Posts: 1
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic