Other URL Schemes | WebReference

Other URL Schemes

Front Page12345678

Other URL Schemes

In this section I'll briefly mention a few other commonly used URL schemes. This is by no means an exhaustive reference. If you require more information on URIs and URI schemes, a list of documents that will help is mentioned at the bottom.

The mailto scheme

The mailto scheme is an example of an opaque URI scheme. mailto URLs identify someone's e-mail address. Their syntax is simple. You have the scheme name, the colon, and then the e-mail address. If you're someone who has a thing for collecting e-mail addresses, you might refer to yourself in the following ways:

mailto:stephanos@webreference.com
mailto:stephanos@internet.com
mailto:sp249@cam.ac.uk
mailto:spip@hol.gr
mailto:spip@mercator.nrcps.ariadne-t.gr

(I have more. Don't ask, OK? Just don't ask). An important note here is that somewhere along the way someone came up with the brilliant idea of including the subject of an e-mail in the URL, like this:

mailto:stephanos@webreference.com?subject=Feedback

If you've been paying attention, you'll realize the problem with this. It doesn't make sense: what resource does it identify? URIs identify resources, and don't do anything else. A program might process a mailto URL by sending e-mail to the person, but it might do something else instead; add it to your addressbook, add it to your killfile so you don't see his e-mail, or anything else. There is also a second very important problem with the above syntax: a user agent that doesn't understand it (and there are many) but does understand normal mailto syntax will try to send mail to the address stephanos@webreference.com?subject=Feedback, which is not a valid e-mail address. So even though you might see the above used some times in HTML, don't use it. And if you want to do the world a favor, mail the person who did and tell them not to do it, citing the reasons above.

The ftp scheme

The ftp scheme is very similar to the http scheme, and is used to locate files available via FTP (File Transfer Protocol). The syntax is very similar to http syntax:

ftp://sunsite.unc.edu/pub/Linux/ls-lR.gz

The above URL points to the FTP server on sunsite.unc.edu, to the file ls-lR.gz in the /pub/Linux directory. It is also possible to specify a username and optionally, a password for the connection. The syntax is like this:

ftp://user@host/path/file
ftp://user:password@host/path/file

Note that supplying a password like this is sometimes a bad idea. Some people might tell you this is a huge security risk, but this is not really true: a URL like the one above is typed into your browser will only be a risk if someone peeps over your shoulder and sees the password. The password itself is transmitted unencrypted anyway, and can be intercepted in transit. Before you go paranoid about this, remember that if your read your mail through POP (Post Office Protocol), like most people do, then your mail password is also transmitted in the clear. The lesson in this is that if you're going to be paranoid, at least do it for the right reasons.

The file scheme

The file scheme is used to point to files on your computer. It is slightly tricky, because (most) absolute file URLs aren't really absolute; they're always relative to your computer. However, you can specify the hostname in a file URL. Remember that a URL just tells you where a resource is located, not how to locate it. So this does make sense. If the hostname is omitted, the current host is assumed. If a URL is encountered by a program with a hostname that's different than the one it's working on, it will most likely decide that it cannot access the file, but this has nothing to do with the URL itself. The syntax is again much like the http syntax, only omitting the port numbers, like this:

file:///home/stephanos/public_html/myface.jpg
file://localhost/temp/install_log.txt

Note that the pathname here represents a path name in the local filesystem, so the slashes are usually replaced by a more appropriate character before the file is accessed. Unix uses slashes, Windows uses backslashes, Macintosh and other operating systems use other conventions.

The news scheme

The news scheme is another opaque URL scheme. It is used to refer to Usenet newsgroups or specific messages within these newsgroups. It has two possible syntaxes. One is the name of a Usenet newsgroup, and the other is the message id of a Usenet post. Note that the message id must be entered without the usual angle brackets (< and >).

news:comp.infosystems.www.authoring.html
news:ba-ciwah-1998Jun4-013702@mud.stack.nl
news:*

The third example points to all available newsgroups and can be used to refer to Usenet in general.

The telnet scheme

The telnet scheme has identical syntax to the ftp scheme, with the exception that there is no pathame. Only a hostname, and optionally a port, username and password may be supplied.

telnet://stephanos:secret@somehost.internet.com:35/

The above indicates a telnet session for user "stephanos" with password "secret" on port 35 of somehost.internet.com.

OK, boys and girls. That was the theory. Now let's get down to the nitty gritty...

Front Page12345678

http://www.internet.com

Produced by Stephanos Piperoglou

All Rights Reserved. Legal Notices.

URL: http://www.webreference.com/html/tutorial2/4.html
Created: June 11, 1998
Revised: June 11, 1998