HTML, XHTML, and CSS, Sixth Edition

You are not limited to creating links to other Web pages. You can create a link to any URLFTP sites, files that you want visitors to be able to download, newsgroups, and messages. You can even create a link to an email address.

To create other kinds of links:

1.

Type <a href=".

2.

Type the URL:

For a link to any file on the Web, including movies, sounds, programs, Excel spreadsheets, or whatever, type http://www.site.com/path/file.ext, where www.site.com is the name of the server and path/file.ext is the path to the desired file, including its extension.

For a link to an FTP site, type ftp://ftp.site.com/path, where ftp.site.com is the server and path is the path to the desired directory or file.

3.

Type ">.

4.

Type the label for the link, that is, the text that will be underlined or highlighted, and that when clicked upon will take the visitor to the URL referenced in step 2.

5.

Type </a>.

Figure 6.15. You can create links to all different kinds of URLs.

Tips

  • If you create a link to a file that a browser doesn't know how to handle (an Excel file, for example), the browser will either try to open a helper program to view the file or will try to download it to the visitor's hard disk. For more information, consult Of Plugins and Players on page 282.

  • It's a good idea to compress files that you want visitors to download. This makes them faster to download and it also protects them from being corrupted as they go from one system to another. Allume Systems (www.allume.com) has some good compression tools for both Macs and Windows machines.

  • Links to Usenet news groups (e.g., news:alt.soc.catalan), Telnet (e.g., telnet://lib.wuacc.edu), or even Gopher and WAIS used to be common. However, their dependence on external applications has meant their demise. Nowadays, most everything is handled directly in a browser with HTTP. For example, you can link to a Yahoo Group with a simple link: http://groups.yahoo.com/group/groupname/, where groupname is the official name of the group. Add message/number, where number is the message's id number, to link to a specific message. Of course, some Yahoo groups are private and so your visitors may be asked to log in before they reach their destination.

    Figure 6.16. No matter where a link goes, it looks pretty much the same in the browser (unless you wrap it around a photo). Notice that I've tried to create labels that flow with the body of the text, instead of a lot of "click me's". These are all real links. You can see where they lead by opening this page in your own browser: http://www.cookwood.com/html6ed/examples/links/newotherlinks.html

  • You can preface an FTP URL with name:password@ to access a private FTP site. Beware that browsers keep track of where you've been and the password you used to get there.

  • If you want to create an FTP link to a particular directory on the FTP site (as opposed to an individual file), simply use ftp://ftp.site.com/directory.

  • If you want to link to songs at the iTunes Music Store, you can use Apple's Link Maker to generate the URL (http://www.apple.com/itunes/ linkmaker/). If you are an affiliate (http://www.apple.com/itunes/affiliates/), Apple pays you a commission on songs people buy through your links.

Категории