Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Root-relative versus document-relative links

Posted on 2002-04-29
3
Medium Priority
?
253 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 200 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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying 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

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

971 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