Home
Products
Downloads
Support
Buy
Assistance with HTML paths
Product Name: General Questions
Product Version: N/A
Document Type: Informational
Last Updated: 9/5/2016
Document ID: 66
Summary
Describes the different path options available in HTML for specifying resource links, such as images, include files, etc.

Details

1. Absolute Path
A path that contains a complete address, such as:

    http://www.coalesys.com/sample/page.htm

When an absolute path specification is used, you are giving the web browser all of the information needed to fulfill the request. The web browser will not need to add anything to the path.

    Advantages:

  • Removes all possible ambiguity about the request.

  • Allows you to switch protocols (intra-site) and domains (inter-site).

  • Can be used as a link from any location.

    Disadvantages:

  • Unnecessarily long when referring to resources within the same site or using the same protocol as the current page.

  • Mirror sites or aliases for a site would need to change all intra-site links in order to keep the user on the mirrored site.


2. Root Relative Path
A path that refers to a resource by using the root of the web site as a starting point.

    /sample/page.htm

This type of path is used by the web browser to request a resource that resides on the same web site as the current page. The web browser will process the request after prefixing the current protocol and domain name information.

    Advantages:

  • Can be used on a page that resides in any directory on the same site.

  • Will not break if you move the page containing the link around on your site.

  • Centralized portions of code that contain links such as server-side includes or JavaScript libraries can be used regardless of the directory location of the host page.

  • Site can be mirrored or aliased without changing the intra-site links.

    Disadvantages:

  • Will break if the root of the web site is changed by a directory added above or below the root.

  • Cannot be used to switch protocols, such as 'http' to 'https' or the reverse.


3. Relative Path
A path that refers to a resource by using the location of the current page as a starting point.

    page.htm   - page is in same directory
    ./page.htm   - page is in same directory, alternate syntax
    ./sample/page.htm   - page is in the 'sample' subdirectory
    ../page.htm   - page is one directory above current

This type of path is used by the web browser to request a resource in relation to the current page. The web browser will process the request after prefixing the current protocol, domain name and path information.

    Advantages:

  • Useful for distributing code across multiple machines/sites/directories without breaking the links.

  • Links will not break, even if the root of the website is changed by a directory added above or below current root.

  • Site can be mirrored or aliased without changing the intra-site links.

    Disadvantages:

  • Will break if the current page is moved to new directory location.

  • Makes using centralized portions of code that contain links very difficult or impossible if the site maximizes directory structure.

  • Cannot be used to switch protocols, such as 'http' to 'https' or the reverse.

Copyright © 2024 Coalesys, Inc. All Rights Reserved.