home account info subscribe login search My ITKnowledge FAQ/help site map contact us


 
Brief Full
 Advanced
      Search
 Search Tips
To access the contents, click the chapter and section titles.

HTML 4.0 Sourcebook
(Publisher: John Wiley & Sons, Inc.)
Author(s): Ian S. Graham
ISBN: 0471257249
Publication Date: 04/01/98

Bookmark It

Search this book:
 
Previous Table of Contents Next


An author would only rarely type a cid URL, since they are typically generated by the tool that assembles a mail message or newsgroup posting. Cid URLs are related to mid (Message Identifier) URLs, discussed later in this chapter.

Data URLs

Data URLs allow for inclusion of small pieces of data within a URL—that is, instead of referencing a data resource, data URLs actually contain the data. This is useful for including small chunks of data within a document, such as OBJECT parameters or a small, inline image.

The form for a data URL is rather complex, and you are referred to the specification document listed in the references section for details. In general, data URL have the form

data: mime/type;base64, data-content

where mime/type give the MIME type (and any optional parameters, such as the character set or encoding); the optional ;base64 parameter indicates that the data content is URL-encoded; and a comma separates the data URL parameters from the data content. Some typical forms are illustrated in the following, where datastring corresponds to the data content of the URL.

data:, datastring
A string of data, by default of type text/plain and in the US-ASCII character set.
Data:image/gif;base64, datastring
A string of data that is BASE64 encoded and that corresponds to a GIF image.
data:text/html;version=4.0;charset=utf8, datastring
A string of data that corresponds to HTML content, encoded using the Unicode UTF-8 character set.

Internet Explorer 3/4 and Netscape Navigator 4 understand data URLs that specify data to be passed, via HTML OBJECT elements, to Java or Active-X components. Netscape Navigator 4 can handle data URLs in almost any context; for example, to encode small images (as an argument to an IMG element SRC attribute) or to encode small documents (as an argument to an A element HREF attribute).

File URLs

File URLs specify the location of resources relative to the local filesystem. Since such references are valid only for computers with direct access to the local filesystem (e.g., connected to the same Novell, UNIX, or Windows NT file server), file URLs should not be used in documents to be publicly accessed over the Internet.


NOTE: Do Not Use File URLs for Internet Publishing

Since file URLs are designed to specify local files, and the general public will not have access to your filesystem, file URLs should not be used for documents to be published on the Internet.


The general form for a file URL is

file://int.domain.nam/path/file

where int.domain.nam is the domain name for the system and path/file is the locator of the file. Note that there is no specified port number. File URLs are designed to represent local file access. All browsers allow local file access, often with a pull-down menu, and represent the location using a file URL. The domain name for local file access can either be the special string localhost or an empty field (i.e., file:///...). For example, if you are accessing the local file /big/web/docs.html, the file URL could be either of the following:

file://localhost/big/web/docs.html
file:///big/web/docs.html

where the file could be on a local disk or on a filesystem mounted on the local system from elsewhere.

FTP URLs

Ftp URLs designate files and directories accessible using the FTP protocol. In the absence of any username and password information, anonymous FTP access is assumed (implying a connection to the server as username anonymous, using the user’s Internet mail address as the password). The general form for this type of ftp URL is

ftp:// int.domain.nam:port/resource

where int.domain.nam is the domain name to access, :port specifies the optional port number (the default is 21), and resource is the local resource specification. Here is a typical example, referencing the file splunge.txt located in the directory stuff at the Internet site ftp.mysite.com at the default port:

ftp://ftp.mysite.com/stuff/splunge.txt

You can specify FTP access of a directory using a URL such as:

ftp://ftp.mysite.com/path/

in which case the server returns a listing of the directory contents. Browsers display this information as a menu, allowing the user to navigate through the filesystem or select particular files for downloading.

Special Characters in FTP URLs

The forward slash (/) and semicolon (;) characters are special in an ftp URL. The forward slash indicates directory or other hierarchical structures, while the semicolon is used to indicate the start of a typecode string. Typecode strings, discussed later in this section, must be the last string of the URL (not including any fragment identifier).

Non-Anonymous FTP Access

You can reference non-anonymous FTP resources by specifying, within the URL, the username and password of the account you wish to access. For example, the URL

ftp://joe_bozo:bl123@internet.address.edu/dir1/Dir2/file.gz

references the indicated file on the machine internet.address.edu, accessible by logging in as user joe_bozo with password bl123. This is obviously not a secure way of giving access, since anyone who reads the URL knows joe_bozo’s password.

A more secure alternative is to give only the username, as in:

ftp://joe_bozo@internet.address.edu/dir1/Dir2/file.gz

Netscape Navigator browsers (versions 2 and up) will connect to the remote machine using the indicated username and will prompt the user for an appropriate password. Similarly, Netscape Navigator browsers will prompt for the username and password when the server explicitly requires these quantities and does not accept anonymous user access.

Unfortunately, this does not work with Internet Explorer. Internet Explorer 3 and 4 do not prompt the user for an appropriate password, even if the URL contains only a username, and not a password. Instead, these browsers always use the return e-mail address, configured into the browser, as the password.

A Note about FTP Directory Paths

Directory locations during FTP accesses are defined relative to a well-defined home directory, with the actual location of this home directory depending on the identity of the user making the connection. A user who connects via anonymous FTP is placed in a special “anonymous FTP” home directory and has restricted access to the server filesystem. This security feature permits making certain files publicly available without exposing the rest of the system to unauthorized users. On the other hand, if a visitor connects to the same machine as a registered user, the home directory will be that of the registered user, entirely different from that attained via anonymous FTP.


Previous Table of Contents Next


Products |  Contact Us |  About Us |  Privacy  |  Ad Info  |  Home

Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc.
All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited. Read EarthWeb's privacy statement.