Friday, November 16, 2007

Thou shalt handle the Back button

All web applications should handle the Back button, enough said.

How many times have you seen stuff like this? This is happening in even in renowned program such as PeopleSoft:

"Warning: Page has Expired The page you requested was created using information you submitted in a form. This page is no longer available. As a security precaution, Internet Explorer does not automatically resubmit your information for you. "

That's simply because they have a <form action="post">, on EVERYTHING. Even on going from page to page. If I see that warning you have a failed app.

How many times you see apps that says "do not use the back button"?
Losers who don't know how to work with the back button resolved by telling me not to use it.
Well you can't restrict me! Heck, there is no easy way to hide the buttons!
Some sad souls even use javascript's window.open to pop up a new window with no buttons to prevent that. Well I can STILL use the little known ALT-left arrow trick to simulate a back button. The solution is to handle it, not avoid it in some sad ways.

Tips to all web programmers out there: only use action=post when you actually have a form to input data, otherwise just use links! Make the action on the page process it (save it, do some searching, whatever), and redirect to another page, like a thank you page or display query data. That way the back button will go back to the original page, and not in an embarassing state which caused the warning. This is a simple trick that expensive corporate web apps should know.

No comments: