THE FAMOUS JAVASCRIPT BACK PAGE ROUTINE

This is a very short article to show you a simple and well known technique of giving the visitor the option of returning to the previous page he or she has come from. The method used is very straight forward to implement into your own website using a simple piece of javascript. Best of all it works with all browsers.

Let’s take the following piece of HTML that might be in your webpage:

<a href="previouspage.htm">Click Here to go back 1 page</a>

This example above would place a link on your webpage asking the visitor to click on the link to go back to the page which they have just come from.

Now the only problem with this is if you don’t know what page they have actually come from then you are totally stuck and you don’t really know where to link them too. This can be resolved using the following replacement for the above example:

<a href="javascript:history.back(%20)">Go back to the previous page</a>

As you can see we have replaced the desired link to a piece of javascript which checks your history list in your browser, which actually knows where you have come from. Its really that simple.

So by including the above html exactly as show, it will give your visitors the option of viewing the previous page.