Posted about 1 year ago, by Specific

When creating a website the creator must remember the user and their need to know where they are in the site.  Users can easily get lost within the site's navigation and not remember how they got where they are.  A simple way to fix this without adding a full breadcrumb system like we have here at zonehacks is to simply add a way for the user to travel backwards through the pages with Javascript.

Yeah web browsers have the back button that will do exactly the same thing, however, why should the user rely on the web browser to save them?  The javascript method of venturing back through the site is simple and can be implemented in many different ways.

Fig. A:

In Fig. A I show how to use an input button to take the user back one page.

Fig. B:

In Fig. B I show how to add a back image that the user can click on to go back one page.  The image can also be replaced to just say "Go back to previous page."

The javascript doesn't just limit you to going back one page, you can change the -1 to -5 if you wanted and would take the user back 5 pages that they have visted.

 

Author Info Comment
Jordan
Posted about 1 year ago.
User Avatar

Also, you could try using, PHP's $_SERVER["HTTP_REFERER"] superglobal.

If its set it SHOULD reffer them back to the visititng URL, also it would have refreshed the page :) not just loaded one from the browers cache!

Usage:

 

But the Refferer IS set by the browser and can be changed, but its generally pretty good.