Random Tech Findings
Atom FeedAtom Feed
Thursday, April 01, 2004
I think quite a lot of developers would have come across the problem of somehow cancelling the refresh action of the user. Normally on a posted page, a box with re-posting message shows up which allows you to , well, re-post or cancel. From my searching till now, there is no way you can stop the refresh. If you think you do not have the ID10t user problem, below is the suggestion that I found at various places. User onBeforeUnload event in the page.
<BODY onBeforeUnload="event.returnValue = 'Press Cancel to not Refresh.';">
But the problem is this event is called in the following circumstances.
1 Close the current browser window.
2 Click the Back, Forward, Refresh, or Home button.
3 Click on an anchor that refers the browser to another Web page.
4 Invoke the anchor click method.
5 Invoke the document write method.
6 Invoke the document open method.
7 Invoke the document close method.
8 Invoke the window close method.
9 Invoke the window open method, providing the possible value _self for the window name.
10 Invoke the window navigate or NavigateAndFind method.
11 Invoke the location replace method.
12 Invoke the location reload method.
13 Specify a new value for the location href property.
14 Navigate to another location by entering a new address or selecting a Favorite.
Of course one can do solution on the server to handle reposting by session variable and cookies manipulation depending on the situation. But seems like no simple solution.