Skip to main content

Relative vs. Absolute Pathnames

Files are stored on a filing system which presumably has a directory structure into which files are stored. When a master document is loaded into a browser it has to be referenced so that the browser can load the required file. This might mean giving a complete, or the absolute, pathname to the file.

Having loaded the master document then subsequent documents can be referenced using just their file names - provided they are all stored in the same sub-directory as the master document. This is called a relative link.

Hypertext referencing is equivalent to using any file store operating system. Once you have moved into a current working directory then files can referenced by their names. But files in other sub-directories have to be referenced via their absolute pathnames.

In general, it is best to set related files so that they are stored in the same sub-directory so that relative file naming can be used - its quicker!