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?
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.
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.
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.