you are here
there are no
It seems like there are two ways
to link to pages now: relative paths and
Well, relative paths can only be
used to link to pages
the same Web
site, while URLs are typically used to link
to other Web sites.
Wouldn’t it be easier if I just
stuck with URLs for links to my own
pages and outside pages? That would
work wouldn’t it?
Sure, it would work, but there’s
a couple of reasons you don’t want to go
there. One problem is that URLs are hard
to manage when you have a lot of them in
a Web page: they’re long, difﬁcult to edit,
and they make HTML more difﬁcult to read
(for you, the page author).
Also, if you have a site with nothing but
URLs that link to local pages and you
move the site or change its name, you
have to go change all those URLs to
reﬂect the new location. If you use relative
paths, as long as your pages stay in the
same set of folders – because the links
are all relative – you don’t have to make
any changes to your <a> element href
So, use relative links to link to your own
pages in the same site, and URLs to link
to pages at other sites.
Haven’t we seen one other
protocol? I kept seeing “ﬁle://” before
we started using a Web server.
Yes; good catch. T
he ﬁle protocol
is used when the browser is reading ﬁles
right off your computer. The ﬁle URL,
for example, “ﬁle:///chapter4/starbuzz/
index.html”, tells the browser that the
ﬁle “index.html” is located at the path
“/chapter4/starbuzz/”. This path may look
different depending on your operating
One important thing to notice in case you
try to type in a ﬁle URL is that the ﬁle URL
has three slashes, not two, like HTTP.
Remember it this way: if you take an HTTP
URL and delete the Web site name you’ll
have three slashes, too.
Are there other protocols?
Yes, many browsers can support
retrieval of pages with the FTP protocol,
and there is a mail protocol that can send
data via email. HTTP is the protocol you’ll
be using most of the time.
I’ve seen URLs that look like
index.html. Why is there a “:8000” in
The “:8000” is an optional “port”
that you can put in an HTTP URL. Think
of a port like this: the Web site name is
like an address, and the port is like a
mailbox number at an address (say, in an
apartment complex). Normally everything
on the Web is delivered to a default port
(which is 80), but sometimes Web servers
are conﬁgured to receive requests at a
different port (like 8000). You’ll most likely
see this on test servers. Regular Web
servers almost always accept requests
on port 80. If you don’t specify a port, it
defaults to 80.
At Caffeine Buzz we use relative
links to other pages on our site,
and URLs to link offsite, like