www.cryer.co.uk
Brian Cryer's Web Resources

How to return to the previous page

There are two ways to return to the previous page using JavaScript. These are functionally equivalent:

history.back();
history.go(-1);

If it is more convenient, the 'history.back()' function can be called via a link, e.g:

<a href="javascript:history.back()">Try it now</a>

gives 'Try it now'.

These are functionally equivalent to the browser's 'back' button and will have no effect if there is no previous page.