CodeBrain.com
javascript / dhtml
Return to Index
Using the Browser History for a Universal 'Go Back' Link
About This Demo...

CodeBrain Visitor J. R. Beltman wrote in recently to ask:

How do those links work which send you one page (of your history) back,
seen at the [CodeBrain Java applet] demo pages?
Best Regards...

J. R. Beltman - 10/17/99

This is a really easy one, but it's a good question and a very useful technique.  We've done this  demo in a pop up... so CLICK HERE.

On the pop-up demo, click on the link that says GO FORWARD then on the link that says GO BACK.

It appears that there are just two regular <A HREF> links at work, and in the case of the GO FORWARD link, that's true.

But the GO BACK link is different!

The GO BACK link advantages what is called the browser 'history' to return to whatever page you were on last -- and does not have to be linked to any specific page at all... wherever you were previously, regardless of the page, that's where it goes.

Suggested Uses & Use Notes

There are many uses for the browser history, but one of the most common is a situation where you have a single page that you want to link to from many pages -- but then have that multi-use page link back to any page that called it.

For example, on our site, we have a 'Link Test' page that any of a number of applets link to... which then refers back to whatever applet page called it.

If standard <A HREF> links were used, we'd have to use a different page for every link test page -- and that would mean hundreds of them -- with a specific link back to whatever applet page had called the link test page.

Using the JavaScript history, we need only one link test page.

Note that this simple JavaScript technique works in ALL browsers.

The Code & Instructions...

Click HERE to Select the Code.  (Pressing Ctrl+C will then place it in your Clipboard.)

 

Return to Index
CodeBrain.com
Copyright 1996-2004 by CodeBrain.com
All Rights Reserved