Feature Post


JavaScript: A Quick 'Back-Button'

JavaScript: A Quick 'Back-Button'

Some time back I wanted to a quick Javascript based 'Back Button' functionality. So I used following:


Though above did come handy as a solution, but it was full of surprises as well. The "con" that comes along is something that your application may not desire/intend.

For instance, in cases where you, lets say, are designing a page that performs an online bank account transaction; and along with other forms' elements you also have a "Submit" button, that gets disabled after you click it; precisely to avoid duplicate transaction.
You click on the submit button and the application throws you on to a next page that has this "<< Go Back" link. Now your spine may get a shiver or two to know that after coming back to the orignal "online-transaction" page, your "Submit" button is disabled. Now WTF?

It is because, usually, when a Form gets validated, we tend to disable the Submit button to avoid multiple hits; Specially in cases of online/form based transactions.

So what can we do about it?

1. Use Back Button where validation is not being performed. Or there is no Form/elements.

2. Use AJAX for on-the-fly validation, and show validation messages on the same page.

3. Use Server.Transfer(Url) to go back.

4. Or probably handle the UnLoad event which will enable the button back to original state using JavaScript.

Happy Go-Back buttoning! (0: