The Evil Back Button

The Evil Back Button

Old forum URL: forums.lhotka.net/forums/t/2229.aspx


MadGerbil posted on Monday, January 29, 2007

I've a form that shows a nice collection of objects in a datagrid.  The user can creat new instances of the objects and click an 'add' button to add items to the datagrid, and of course, to the collection of objects held in the session.

...and then the user clicks the ugly, evil BACK button on his browser.

These means the user now sees the collection as empty or as having one less item than what it really has - the screen doesn't match the actual collection as it exists in memory. 

Do you guys handle this in any particular way?

SonOfPirate replied on Monday, January 29, 2007

A common trick is to use client-side javascript to purge the history so that the back button is negated or set the most recent entry to the current page.  Do a search on the web and you'll find many examples.

MadGerbil replied on Monday, January 29, 2007

Cool, thanks.

Does that script still work if javascript is turned off in the browser (security level, I mean)?

Copyright (c) Marimer LLC