Publishers of technology books, eBooks, and videos for creative people

Home > Articles > Design > Voices That Matter

Web Design Reference Guide

Hosted by

URIs

Last updated Oct 17, 2003.

Whenever using a browser, you enter a HTTP Web address (http://www.something.com) to take your browser to a specific location on the Internet. This is the most common form of URI (Universal Resource Identifier), and it accesses information to a resource at a specific location on the Internet. For the most part, the URI is an address on the Web that identifies each document uniquely. For example, http://www.informit.com/articles/index.asp brings up the articles main page. The syntax for a URI is scheme://host/path.

There are two types of URIs: relative and absolute. Relative URI is the shorthand version of a URL to other documents from within the same server such as /images/picture.gif. The browser knows to translate this into a full URI syntax before sending the request.

We can enter the image element two ways (this uses XHTML formatting, which requires a back slash on the end):

<img src="/images/picture.gif" />
<img src="htp://http://www.informit.com/articles/images/picture.gif" />

The first one is an example of a relative URI while the second and longer example is an absolute URI. When loading http://www.informit.com/articles/index.asp, and the file contains an image reference to /images/picture.gif, the browser knows to convert the relative URI to http://www.informit.com/images/pictures.gif.

Every resource on the Web has an address that can be encoded by a URI. Resources can be images, audio clips, HTML documents, or applications. For example, URIs can do the following:

  • Link to other documents, stylesheets, and resources via the A and LINK elements
  • Link to script via the SCRIPT element
  • Include an image, applet, or object in a page using IMG, APPLET, OBJECT, and INPUT elements
  • Submit a form using FORM

URL (Universal Resource Location) is a subset of URI. All URLs are URIs, but not all URIs are URLs. There is one other type of URI called URN (Universal Resource Name), which has institutional persistence (meaning that its location may occasionally change, but it will be found). If a URL location changes, it's not likely to be found.

URN and URL are different in that a URN's primary purpose is a persistent label of a resource with an identifier. The identifier comes from one of a set of defined namespaces in which each has its own set name structure and assignment procedures.

Figure 1

Scheme, which is the protocol that connects to the site, can be FTP, TELNET, NEWS, MAILTO, or HTTP. In this case, we're using HTTP. Host is the connecting host, which is http://www.informit.com in this example. The path is the document on the server, and its index.asp. You've probably seen more complicated URLs:

http://www.informit.com/guides/content.asp?g=webdesign&seqNum=9.

The part after index.asp is the query used by server-based programs such as ASP (Active Server Pages), JSP (Java Server Pages), CFM (ColdFusion), and CGI (Common Gateway Interface). URI follows this syntax: Scheme, authority, path, and query. Note the URI uses authority instead of host. Authority references a host name or the server's IP address. In some cases, both can include the optional network port number in which the default value is 80. An example:

http://www.informit.com:80/

URIs are a work-in-progress: They're not yet a working standard because they have many open issues needing closure before they're complete.