Most web sites have a navigation problem. You put up a bunch of pages, but new visitors do not know where to start or what order to read things in. They click around randomly, miss the best content, and leave. What if you could give them a guided tour?
I wrote a Java applet called TourGuide that does this. Think of it as a precursor to a smart agent that works as a tour guide to a site. The applet opens in a smaller popup window and presents a sequence of links. The visitor clicks through them one at a time, in an order you have chosen, seeing the pages you think are most worth visiting.
The key design choice is that the tour data lives in a plain text file, not in the Java code. The applet reads a data file that contains the list of links, titles, and descriptions. When you want to change the tour, you edit the text file. You do not have to recompile the applet. This means someone who does not know Java can maintain the tour just by editing a simple text file.
The applet itself is embedded in a page with an <APPLET> tag. When a visitor loads that page, the applet starts, reads the data file from the server, and presents the first stop on the tour. Navigation controls let the visitor move forward and backward through the tour. Each stop opens the target page in the main browser window while the applet stays in its smaller window, acting as a persistent guide.
The popup window approach keeps the tour controls visible while the visitor reads each page. It is like having a small control panel that floats alongside the browser. The visitor can close it at any time if they want to explore on their own.
For a newspaper web site, a tour can introduce new visitors to the different sections, highlight the features of the site, show them how to find classified ads, or walk them through the opinion pages. For a corporate site, it can show your products in a logical order. For a personal site, it can present your portfolio the way you would present it in person.
Java applets are well suited to this kind of thing. The applet runs in the browser, it can open new windows, it can make HTTP requests back to the server to load the data file, and it works on any platform that has a Java-capable browser. Netscape Navigator 2.0 and later support Java, and other browsers are adding support.
The separation between the applet code and the tour data is the part I think matters most. A tour guide is only useful if you can update it easily. Putting the link data in an external file means the person who knows the content can maintain the tour without involving a programmer. That is how tools should work: the technology stays out of the way and lets the content people do their job.
The applet is freely available for anyone to use on their site.
Here is the full source code:
/**
TourGuide.java
An Applet by Rajiv Pant (Betul)
A web site navigator, also
a Tour Guide for your visit to a web site or a group of web sites.
Parameters can be set from calling html page so that other sites
may easily use this applet.
Aim of applet / Future Additions:
* To be fully customizable.
* Use full multimedia introductions to sites. (Of course, users can
turn off sound :-)
* If a page has special instructions for its introduction (which may
either be stored in the page itself on in the links file specified
as a parameter to the applet, the applet can do special things including:
** Open another window to display an introduction page.
** Parse the page and display it in parts explaing things.
@version 1.00 1996/Mar/14
@author Rajiv Pant (Betul)
*/
import java.awt.*;
import java.applet.*;
import java.net.*;
import java.io.*;
import java.util.* ; // for Hashtable
public class TourGuide extends Applet
{ public void init()
{
System.out.print ("\n\nHello.\n\n" ) ;
setBackground (Color.white) ;
boolean read = readLinksFile() ;
setLayout(new BorderLayout());
add("Center", links);
}
public boolean action(Event evt, Object arg)
{ if (evt.target == links)
{ try
{ AppletContext context = getAppletContext();
URL u = new URL ( (String) ( its_link.get ( (String)arg ) ) ) ;
context.showDocument(u, getParameter("frame_name")) ;
} catch(Exception e)
{ showStatus("Error " + e);
}
}
else return super.action(evt, arg);
return true;
}
private List links = new List(10, false);
Hashtable its_link = new Hashtable() ;
private boolean readLinksFile()
{
System.out.print (
"I am going to read in the list of links now. \n\n"
) ;
URL FileURL = null ;
try
{
FileURL = new URL ( getParameter("links_file") ) ;
}
catch (MalformedURLException e)
{
showStatus("Error " + e) ;
}
try
{
InputStream in = FileURL.openStream() ;
DataInputStream din = new DataInputStream (in) ;
String description = "" ;
String link = "" ;
while ( ( description = din.readLine() ) != null )
{
if ( (link = din.readLine() ) != null )
{
link = "http://" + link ;
its_link.put (description, link) ;
links.addItem (description) ;
System.out.println ("Description: " + description) ;
System.out.println ("Link: " + link + "\n") ;
}
}
}
catch (IOException e)
{
showStatus("Error " + e) ;
}
return true ;
} // readLinksFile
}