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.
Joined: Feb 20, 2006
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.