An absolute URL represents a unique address on the Internet for any piece of digital media (resource). Our textbook (HTML and XHTML: The Definitive Guide) has a useful discussion of absolute URL syntax on pp.172-187, sections 6.2 through 6.2.10, which I recommend that you review. However, in the interests of clarity, I will discuss the most salient features of absolute URLs here in a more comprehensible fashion.
Absolute URL syntax involves two parts, described in our textbook as "scheme" and "scheme_specific_part", which must be separated by a colon and described in this manner (NO SPACES):
scheme:scheme_specific_part
This description, while technically correct, is hardly illuminating. Allow me to explain this to you using ordinary English.
When creating an absolute URL, you must specify what type of absolute URL you want; this is what our book calls the "scheme". Is this a web address? Is this an ftp address? Is this a telnet address? Is this a gopher address? These are the questions that are resolved by stating the "scheme". In this class you will be using only three schemes, which are probably the most common types of absolute URLs on the Web:
http
(Web address)
mailto
(email address)
javascript
(javascript code)
There are two more schemes which you are likely to see, although we will not be using them in this class specifically:
ftp
(ftp site address for transfer of files)
file
(file address on a hard disk or server)
The other schemes mentioned in our textbook are specialty types, and are much less commonly used; we will not discuss them here.
Let us talk specifically of Web addresses (http), since we are most interested in that type of absolute URL. Let us begin by looking at the "scheme_specific_part", with which I expect you are already familiar (at least to some degree).
Here is the address for the main server at Yahoo, the Web's most prominent search engine:
www.yahoo.com
"com" is the domain name.
"yahoo" is the sub-domain name (which is commonly called the domain name).
"www" is the name of the server in the "yahoo.com" domain.
There may be more than one server in a domain, obviously. Netscape, for example, has several:
www.netscape.com
home.netscape.com
developer.netscape.com
etc...
A server is a computer which delivers, or "serves", resources to any computer which requests them. A server which serves resources to computers via an http scheme is called a web server.
There are many different types of domains, as well:
"com" stands for "company"
"org" stands for "organization"
"edu" stands for "educational institution"
"gov" stands for "government"
etc...
The "scheme" for a Web address is "http", which stands for "hyper-text transfer protocol". This "scheme" is followed by a colon, then two slashes which form the beginning of the "scheme_specific_part". Thus, web addresses always begin with the following code:
http://
The absolute URL for the main server at Yahoo, then, would look like this:
http://www.yahoo.com/
"http" is the "scheme".
":" separates the "scheme" from the "scheme_specific_part".
"//" is the required prefix for an absolute web address.
"www.yahoo.com" represents the server, the sub-domain, and the domain name.
"/" is a reference to the root directory on the server. The root directory is the main web folder on the specified server for that domain; there is nothing outside of the root directory which may be served via the Web.
The above absolute URL points to the default or index HTML page on the Yahoo site. Thus:
http://www.yahoo.com/
is a shorthand for the following:
http://www.yahoo.com/index.html
Remember that when you use a URL, you are invoking a resource, which has to be some sort of digital file. Since the first shorthand example didn't explicitly state any text, graphic, animation, or sound resource, the web server at Yahoo had to guess what type of resource was desired. With the http scheme, web servers automatically assume that you are looking for an HTML text resource, namely, an HTML page.
Web servers are configured to serve a default HTML page when none is specified. The server software for the web server at Yahoo has been set to serve "index.html
" as the default page for any directory on the server.
Thus, any sub-directory on Yahoo will automatically serve "index.html
" if no other page is specified. The Arts area at Yahoo, therefore, could be expressed as either one of the following addresses:
http://dir.yahoo.com/Arts/ http://dir.yahoo.com/Arts/index.html
"Arts"
is a sub-directory inside the root directory of the "dir" server at "yahoo.com". The index.html page specified here is inside the Arts sub-directory. To put this another way, index.html is an HTML page inside the Arts folder inside the main web folder on the "dir" server at Yahoo.
Here is another example from Yahoo:
http://dir.yahoo.com/Arts/Art_History/ http://dir.yahoo.com/Arts/Art_History/index.html
Again, these URLs are identical at Yahoo. "Art_History"
is the name of a folder, which lives inside of the "Arts"
folder, which lives inside of the main web folder for the "dir"
server at Yahoo. "index.html"
is the main HTML page inside of the "Art_History"
folder, and serves as the default page when no other page is specified.
Here is a picture to further illustrate the above examples:
You can see that a path may be specified in an absolute URL, leading through a hierarchy of directories/folders to a specific resource (in this case, a default html page). Each directory/folder in the address must be separated from the server or from the other folders by the slash (/) character. To the left of the slash (/) character is the server/domain or folder name, to the right of the slash (/) character is the desired piece of content in the folder (either a resource or another folder).
Not every server on the Web has been configured to serve "index.html" as the default page. The three most common default page names are:
index.html
default.html
welcome.html
You must talk with your server administrator (or read the FAQ published by your ISP) to find out how the default page name for your personal web site has been configured.
Note: If NO page in a particular directory has the default page name AND a user invokes an absolute URL to that directory without specifying a page name, the web server will usually deliver an index of ALL of the files in that particular directory to the user.
Example:
http://www.michaelmasumoto.com/flash/
Of course, pages other than a default HTML page may be accessed from a website using an absolute URL. Here are some examples:
http://www.michaelmasumoto.com/msi/completeSite/home.html
(home.html page in the completeSite folder in the msi folder in the main web directory for the "www" server at michaelmasumoto.com)
http://www.widget.com/dog/biscuit.html
(biscuit.html page in the dog folder in the main web directory for the "www" server at widget.com)
In fact, you can access any resource using an absolute URL. Here are some examples:
http://www.michaelmasumoto.com/greed/TitleGraphic.gif http://www.michaelmasumoto.com/htmlOnline/poppyOzma2.JPEG etc...
Remember that URLs are case-sensitive. That means that the following URLs are NOT identical:
http://www.michaelmasumoto.com/greed/ http://www.michaelmasumoto.com/GREED/
Activity: Try typing these two URLs into the location bar of your web browser and see what comes up...
You MUST match case when you type out URLs, which means spelling your URLs with the exact same upper-and-lower-case combinations that appear in the original file or directory name.
Absolute URLs for email addresses involve using the "mailto" scheme mentioned above. The format is simple: "mailto" followed by a colon (:), followed by the email address desired (NO SPACES!). This would be a mailto URL for my email address:
mailto:michael@michaelmasumoto.com
If you type this URL into the location bar of your web browser, you will get a new email message with the appropriate email address pre-typed into the address area.
Here are more examples:
mailto:csadmin@digidesign.com mailto:somebody_important@apple.com mailto:jobs@lavamind.com etc...
mailto URLs are normally used to create automatic email messages from a hyper-text link on an HTML page. We will discuss creating hyper-text links later in this module.
Using an absolute URL with a "javascript" scheme, you can invoke a JavaScript program. Here is an example:
javascript:alert('Howdy');
Here is a demonstration of the above example:
As you can see, the above URL can cause an alert dialog box to appear which says "Howdy". I will introduce JavaScript and the javascript absolute URL "scheme" in a later module.
Copyright © 2001 Michael Masumoto. All Rights Reserved.