Greg's Blog

helping me remember what I figure out

Stopping a Page Refresh

| Comments

I found myself having to trap a user attempting to refresh a page for one of our web apps. After a little bit of digging I stumbled across this solution: [code] [/code] To use it simply embed or include it into your template Eventhough the article says this is a IE specific event/feature it also works in FireFox. You should be aware that whenever the user leaves the page, they will be prompted about their impeding data loss, which can get a little tedious while developing. Again this became a handy feature for our AJAX apps as most of the processing is done in the background without the page reload, a user could accidentally hit the back button and loose where they were at.