今天是阳历 2024 年 04 月 28 日 星期日 农历 三月月 二十日

 

[Online Resource Centre 教学材料]   [E-Teacher 电子教师]   [Web Basics 网页基本常识]
 

Navigation with Browsers

URL Addresses

URL Addresses | URL Details | Relative Addresses | URL Summary | Methods of Navigation | Going Further

A Uniform Resource Locator or URL address is a wedding of the information in the IP address for a machine and the information in its local file structure. Thus a URL address gives the location of a file, not with respect to a single computer, but with respect to the entire Internet!

What Are URLs: An Analogy

Imagine that you live in a large building and that your address in the building corresponds to a room number. We might call that a local address: anyone in the local building can locate you by using your room number. That is analogous to the name of a file on a single computer: anyone logged into that computer can locate a file on the computer if they know its name, and what folders or directories it resides in (and have permission to look in those directories).

Now imagine that someone from another country wants to locate you. The local address within the building is no longer sufficient because it doesn't specify how to find your building. At the very least, it is necessary to specify additional information giving the country, city, street, and so on of the building in which you reside.

This is now analogous to the information that a URL address provides: a URL address gives a unique address for a file with respect to anywhere on the Internet, just as your complete residential address gives a unique way to locate you from anywhere in the world. Thus, URL addresses allow the computers of the Internet to behave at a certain level as if they were a single computer.

What do URL Addresses Look Like?

Here is an example of a URL address:

http://csep10.phys.utk.edu/webcourse/browser/textfile.html

This is a functioning URL address, and it is also a hypertext link (notice the color and the underline, and that if you hold the mouse over the link the pointer turns into a pointing hand, all of which indicate that this is a link). Therefore, you can go to it by clicking on it. Try it (but then come back here, by using the Back button on the browser).

URL's Can Address More Interesting Things

The preceding example shows the use of a URL to specify a file containing text. However, URL's can be used to address much more general things. For example, try the following links corresponding to

An image at http://www.techcorps.org.org/webcourse/browser/usa2.gif

A sound file at http://www.techcorps.org/webcourse/browser/hasta_la_vista.au

A movie file at http://www.techcorps.org/webcourse/browser/goldgate.mpg

Therefore, we see that a URL address is a very powerful thing, allowing us to address many different kinds of files.



Comments: Case Sensitivity

This is as good a place as any to issue a warning about a common pitfall in accessing directories and files on the Internet. Some computer systems (for example, Unix) use case-sensitive names for files and directories; others, (for example, Windows and Macintosh) ignore the case in such names. Thus, on a Windows computer file1 and File1 refer to the same files, but on a Unix system these would generally be two distinct files.

You can come to grief over this in the following way: Suppose you have a GIF file named myfile.GIF on your Windows computer and you access it locally from your browser using a Web link of the form

<a href="myfile.gif">

This will generally work on your Windows computer because it views myfile.gif and myfile.GIF as the same files.

Confident that everything is working as it should, you now transfer the file containing this link and the GIF file to a Unix Web server and try to access this link over the Web. To your dismay, you (and anyone else on the Web trying to access your file) will now get an error message that the file myfile.gif is not found on this Web server. Why? Unix is case sensitive, therefore (unlike the Windows computer that you used to develop the files), the server views myfile.GIF as being a different file from myfile.gif and croaks. The only cure in this case is to change either the filename in the link or the name of the GIF file so that the names are case compatible.

Comments: Blank Spaces

A second pitfall in Web addressing is associated with the fact that different systems deal with blank spaces in file or directory names in different ways. For example, Windows file names can have blank spaces, but Unix systems generally use blank spaces as separators between names. Thus, a filename July Budget Reports is a perfectly acceptable filename for Windows, but is a bad choice for a Unix system because it will interpret this filename as July because of the trailing blank space unless special actions are taken. (For example, always enclosing the entire filename in double quotes would cause a Unix system to construe the blank spaces as part of the file name.)

The common ways that Unix systems name such files without employing blank spaces is to use upper case letters to start words (with no blanks between words), or to use underlines or dashes to indicate where blank spaces would be. For example,

  • JulyBudgetReports

  • July_Budget_Reports

  • July-Budget-Reports

would all be acceptable Unix filenames.

Words to the Wise

Now if you are a Windows user developing your own material for the Web, you probably would like to ignore these "peculiarities" with Unix systems concerning case sensitivity and blank spaces. Unfortunately, you cannot because most of the servers on the Internet use Unix operating systems, and indeed the Internet itself largely developed in a Unix environment. This has two consequences:

  1. Because of the Web's Unix heritage, URL addresses generally cannot contain blank spaces (if blank spaces are required they must be inserted with special character sequences).

  2. If your Web material is served from a Unix server, the case of filenames and directories will matter.

Therefore, if you are going to be developing material for the Web, we suggest strongly that you immediately get into the habit of (1) assuming case sensitivity in all your filenames, and (2) not using blank spaces in any filenames.

 
[Online Resource Centre 教学材料]   [E-Teacher 电子教师]   [Web Basics 网页基本常识]
      School Name 学校名称
      Online Resource Information 线上资源资讯
      News & Events 学校新闻
      Events Calendar 每日事件