Uniform Resource Locators
|
URLs are the basic addressing mechanism for the World Wide Web.
|
A Hyperlink
is a reference from one document to another.
A document (aka
hypertext
or
hypermedia)
is a text, video, or audio file, or a gateway to a service.
Documents may contain hyperlinks to each other.
This reference contains 2 parts: on screen, the user sees some text or
an image that's distinct from non-hyperlink text/images
(e.g. underlining). Hidden from the user, there's an `address' pointing
to the referenced document.
A
URL
(Uniform Resource Locator) is an address that supports a hyperlink.
The user needn't see this, only the text/image representation on screen.
Think of it as a networked extension of the standard filename
concept: not only can you point to a file in a directory,
but that file and that directory can exist on any machine on the
network, can be served via any of several different methods,
and might not even be something as simple as a file:
URLs can also point to queries, documents stored deep within databases,
the results of a finger or archie command, or whatever.
It is possible to represent any
file or service on the Internet with a URL.
Every resource available on the Web -- HTML document, image, video
clip, program, etc. -- has an address that may be encoded by a
Uniform Resource Locator, or "URL".
URLs typically consist of three pieces:
- The naming scheme of the mechanism used to access the resource.
- The name of the machine hosting the resource.
- The name of the resource itself, given as a path.
An example:
http://WWW.Stars.com/index.html
- The initial portion
of the URL (before the two slashes) specifies the method of access.
This can be http, ftp, file, gopher, news, telnet, ...
- The second
is normally the address of the machine where the data or
service is situated.
- Additional
portions may define the names of files, the port to link to,
or the document to search for in a database.
Most Web browsers permit the user to enter a URL to link to that
document or service.
When choosing hypertext in an HTML document,
the user is really sending a request to open a URL.
Hyperlinks can be made not only to other media,
but also to other network services.
Web browsers are not simply Web clients,
but are also full-featured FTP, Gopher, and telnet clients.
Fragment Identifiers
Some URLs refer to a location within a resource. This kind of URL
ends with "#" followed by an anchor identifier (called the "fragment
identifier"). For instance, here is a URL pointing to an anchor named
section_2:
http://somesite.com/html/top.html#section_2
Relative URLs
A relative URL doesn't contain any naming scheme
information. Its path generally refers to a resource on the same
machine as the current document. Relative URLs may contain relative
path components (".." means one level up in the hierarchy defined by
the path), and may contain fragment identifiers.
Relative URLs are resolved to full URLs using a base URL.
As an example of relative URL resolution, assume we have the base URL
"http://www.acme.com/support/intro.html". The relative URL in the
following markup for a hypertext link:
<A href="suppliers.html">Suppliers</A>
would expand to the full URL "http://www.acme.com/support/suppliers.html",
while the relative URL in the following markup for an image
<IMG src="../icons/logo.gif" alt="logo">
would expand to the full URL "http://www.acme.com/icons/logo.gif".
|