Link Questions Back to Main FAQ

For general information on links check out Netscape's Web site (http://www.netscape.com).


1. What is the difference between Absolute and Relative links? What is the Base URL and should I set it and to what?

2. How do links and anchors work?


1. Question: What is the difference between Absolute and Relative links? What is the Base URL and should I set it and to what?

Answer: Absolute links point to a specific point on the Internet. They are in the familiar URL form used to tell WWW browsers where to go. The URL of this FAQ, for instance, is "http://www.ee.pdx.edu/~jeskem/chpfaq.html " . Any where a link to this URL is put, it will point to this document, and only this document. If this document were to move, all the links which point to it would have to be changed. Absolute URLs are usually used to link to documents on other sites, that is, if a document is at site www.mysite.org, any link in that document which does not point to a document on www.mysite.com would be an absolute link.

Relative links are simply file and directory pathnames described relative to the ABSOLUTE URL of the document which contasins the links. So, if a document has a link to a file on the same server, the link can and should be a relative link. Here is the form of relative link: a file in the same directory - "file.html", a file in a subdirectory - "subdirectory/file.html", a file in the parent directory - "../file.html", a file in the parent of the parent directory - "../../file.html", a file in the base directory of the same site - "/file.html", and finally a file in a directory in the base directory - "/directory/file.html". Relative links allow a set of Web documents to be portable across different sites, since no matter where the set is, the links are defined relative to the documents. So if, if you move a site which employs relative links only, except for links to other servers, to a different location, the still work as before. If you had used absolute links, you would have to change the links to every document you moved.

You can decide whether CHP will always create Absolute URL or not. Choose "Preferences..." from the Edit menu and select HTML Output in the pop-up menu. Then set the Use Absolute Pathnames checkbox.

Sometimes you will have a html page which contains a bunch of link to the same site, but not the site the document is on. This may happen if you store, say, your poetry collection on one server, but have it cataloged with links on another server. In these situations it is useful to use a Base URL. In CHP, you can add a Base URL to a document by choosing "Document Options" from the "Edit" menu, and choosing "General" from the pop-up menu. So, if you are making your catalog file, and you store your poetry on www.mysite.org in the directory "mypoetry", you would enter "http://www.mysite.org/mypoetry/" as your Base URL. In your document, you just need to put the name of the poem file in the URL field. If in the future you move your poetry collection to www.mysite2.org, you will just need to change the Base URL. TOP


2. Question: How do links and anchors work?

Answer: Links are a way to identify a series of elements, which, when clicked on, take the browser to another page. These elements can be text, graphics, or both. There are several ways to create a link. First select the elements you want for the link, then:

1. Open the Link Editor and type in the URL, select a currently open document or a recent link from the pop-up menu, or browse using a standard file dialog box with the Browse files button.

2. Click the Insert Link to File button and choose the file using a standard file dialog box.

3. Drag a file from the Finder into a CHP window, and a link will be created.

Anchors are a way to name a particular place in a web page. That way, you can refer to that place later. To create an anchor, put the cursor where you want the anchor, and use the Insert:Anchor... menu item or the anchor button. In the dialog box, type a name for your anchor.

To link to a particular anchor, just add a # and the name of the anchor to the URL of the page the anchor is on. If the link is on the same page as the anchor, you just need to use a # and the name of the anchor as the URL. You can also link to anchors in the pop-up menu to the right of the URL filed. Make sure the page you want to link to is open, and the anchor(s) are already set-up. Then choose the elements of the link, open the pop-up menu, and move your cursor down to the name of the page. A sub-menu with all the anchors will appear. Select the anchor and your link us done.

This is only a quick summary. In the future it will improved with some graphics etc. For more information:

Watch the list.

Check out Netscape's Web site (http://www.netscape.com) or other HTML tutorials.

A list of HTML and CHP resources is available at Ken Tidwell's site http://www.sna.com/kt/frms/chp/CHPWEBHelp01.html. TOP


Created by: Marcin Jeske (jeskem@ee.pdx.edu)

 Made with Macintosh and Claris Home Page