Solved

Root-relative versus document-relative links

Posted on 2002-04-29
3
242 Views
Last Modified: 2008-02-01
Is it better to use root-relative links or document-relative links? I am writing simple HTML code, no dynamic loading of pages, and I have heard different opinions about this. It seems that if you don't expect the subdirectories to change then document-relative links should be okay. The webpages concerned are static: they are electronic versions of annual reports, etc. which have been released in hard copy, and each one consists of a collection of subdirectories containing several documents (linked to the contents.htm and index.htm pages) which should not change once they are uploaded to a website.
0
Comment
Question by:MChild
3 Comments
 
LVL 17

Accepted Solution

by:
dorward earned 50 total points
ID: 6977100
I generally stick to document relative, it leaves the links as portable as possible and therefore gives the most scope for any future changes.

Example: Not too far down the line somebody decides that it would be a good idea to distribute or archive these files to CDROM. With document relative links the files can be simply dumped to disc, if it was root relative then people access the disc would probably experience lots of file not found errors.
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 6977354
I think dorward has hit on the primary reason for keeping the links document- relative...portability.  The only time is use root-relative links is for secure
ass on intranets where I need access limitations resident on the local domains
on the local domains.

For general purpose apps an just about everything on the Internet, document-
relative, is the best way to go.

Cd&
0
 

Author Comment

by:MChild
ID: 6980076
Thanks, I will also be putting some of these onto CD so that's a good point.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question