Using Absolute Paths


An absolute path gives the full URL of the desired Web page, including the http://www part, like this:

 <a href="http://www.pearson.com/">Absolute path</a> 

In other words, an absolute path is exactly the same as the URL that you type into a browser's Address field. To go to the page in question, you don't have to type a different URL when you use a different computer or if you're on a different Web site. That's what makes the path absoluteit's always the same, no matter where on the Web the browser happens to be looking.

TIP

Use absolute paths for external links, or links to pages that don't belong to your Web site. In fact, you have to use absolute paths for this purpose. Document-relative and root-relative links don't work with external pages.


Since absolute paths are always the same, you don't have to update them in the source code if you change the position of your page in your site's hierarchy. You can move a page with an absolute link anywhere on your site, and the link always connects to the desired page, as long as the URL in the href attribute is accurate.

GEEKSPEAK

An internal link is a link to a page within your Web site, while an external link is a link to a page outside your Web site.


But since you have to give the full URL whenever you write an absolute path, these paths can be cumbersome for internal links, or links that go to pages on your own Web site. Document-relative or root-relative links are generally better for internal links. Moreover, for absolute paths to work, your computer must be actively connected to the Web. If you open a browser window offline to test your site, clicking a link with an absolute path causes the browser to make an Internet connection.

FAQ

Can I use document-relative paths for external links?

No. Document-relative paths are for internal links only.




Web Design Garage
Web Design Garage
ISBN: 0131481991
EAN: 2147483647
Year: 2006
Pages: 202
Authors: Marc Campbell

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net