Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Back Link: The Basics

The first step in implementing the back link is to download backlink.js and upload it to your server. Load backlink.js into your web page with a <SCRIPT SRC="..."> tag like this:

<SCRIPT TYPE="text/javascript" SRC="backlink.js"></SCRIPT>

backlink.js is implemented by putting a short script in your page. that creates a backlink object, sets various optional properties of the object (we�ll go over all of them later in this section), then calls the write() method of the object. For example, the following script uses a the backlink code in its simplest form, creating a backlink object, then immediately writing it out:

1
2
3
4
5
6
<SCRIPT TYPE="text/javascript">
<!--
var bl = new backlink();
bl.write();
//-->
</SCRIPT>

which gives us this back link:

Let's take a look at this basic example. Line 1 opens the script element and line 2 sets the obligatory comment for older browsers. Line 3 creates a backlink object, storing it in the bl variable. Line 4 then calls the backlink object�s write() method which writes out the HTML code for the link. 5 closes the comment and 6 closes the script element.

No History, No Link

The backlink object uses object detection to test if the history.back() method works. If the browser does not support history.back(), or if the browser is in the first page it has loaded since the browser opened (i.e. there is no page to go "back" to), then the back link is not written out. This is why it is better to use a scripting object to write out the link instead of hardcoding the link into the page.

Now let's look at customizing the back link.

 
 
  Copyright 1997-2002 Idocs inc. Published under the terms of the Open Content License Design by Interspire