When Tim Berners-Lee was designing the protocols for the World-Wide Web, one issue he contemplated was: Should links be one-way or two-way? On the one hand, since a link communicates information about the relationship between two documents, readers of either document might want to know about the relationship, so links should work in both directions. On the other hand, if two documents are being managed by two different authorities (e.g., The New York Times and Spinsanity), a protocol that requires two-way links would require both authorities to cooperate with each other to maintain the links.
ENQUIRE, an earlier hypertext system that Berners-Lee wrote, used two-way links, but this was a system where all the linked information was on one server. For the Web, Berners-Lee adopted a technique proposed by Phillip Hallam-Baker: use one-way links, but allow the server to find out where a page is being linked from. The server of the page being linked to can use this information, or ignore it.
...to generate a page like this one. This is how, for example, many custom 404 pages point back to the page with the dead link.#!/usr/bin/perl use CGI qw/:standard/; print header("text/plain"), "To get here, you clicked on a link from ", referer();
If you don't mind information from complete strangers filling up your hard drive, you can write a slightly more complicated script, and make a permanent record of pages linked to your own:
Now, if you create a Web page with a link to this page, and click on the link, you can see your page's URL in the list.#!/usr/bin/perl -T use CGI qw/:standard/; # ignore URLs with invalid characters if (referer() =~ m|^([-\w?.+\%/:&]+)$|) { $r = $1 . "\n"; } else { $r = ''; } open REFERIN, "./referers" or die "Can't open the referers file for input: $!"; @referers = <REFERIN>; close REFERIN; if ($r) { $foundit = grep { $_ eq $r } @referers; unless ($foundit) { open REFEROUT, ">>./referers" or die "Can't open the referers file for output: $!"; print REFEROUT $r; close REFEROUT; push @referers, $r; } } print header, start_html("Example 2"), p("Links to this page have been followed from the following URLs:"), ul(li(\@referers));
To work around these problems, a number of programmers have provided self-contained scripts that can keep track of inbound links and display them on your page, with a minimum of effort on your part. For example, Stephen Downes has a system that is based on Javascript: you add a little Javascript to your page, and when someone reads it, if his or her browser supports Javascript, it calls up a CGI script on his site, and where the HTML source had Javascript, the browser shows a list of links. So, even though the server for this page does not support CGI scripts, if your browser has Javascript enabled, you can see a list of links to this page right here:
Log files provide another source of referral information. If your Web server uses the Combined Log Format, its log file should have lines like
192.168.1.1 - - [01/Apr/2003:14:58:54 -0500] "GET /tb/example2.pl HTTP/1.1" 200 390 "http://ropine.com/essays/trackback.html" "Mozilla/5.0 Galeon/1.2.5 (X11; Linux i686; U;) Gecko/20020623 Debian/1.2.5-0.woody.1"The field marked in boldface is the referrer.
Mark Pilgrim has written PySiteStats, a Python system that generates reports from access logs. Among other things, this system can produce a list of referrers.
Why would anyone go through all this trouble to announce that they've commented on someone else's weblog, when they have HTTP referrers for free? The Trackback protocol has a number of features that ordinary referrers don't have.
The two-way links of ENQUIRE could describe six kinds of relationships:
The Trackback protocol provides one way to carry this information—to announce that one page comments on or is commented on by another. More importantly, the weblogging tools that implement Trackback make it easy for users to exploit the protocol.
What's next? What other protocols and authoring tools can enrich our experience of reading, writing, and linking on the Web? Which of these tools will actually become popular with the users, and which will remain stuck in the land of "if only everyone did this"? Stay tuned, true believers....
Seth Gordon // sethg@ropine.com // April 2003