Absolute vs. Relative URLs
Home ] Up ] Protocols ] Resource Names ] [ Absolute vs. Relative URLs ] The URL Class ] Reading from a URL ] Proxy Settings ]

 

 

The URLs shown in the previous sections are examples of absolute URLs. That is, they contain all the information (perhaps defaulted) necessary to find a resource on the Internet.

There are also relative URLs, which allow you to access resources relative to a known location. For example, it is very common to use relative URLs within an HTML document:

  • #Example -- refers to the anchor Example in the current page
  • images/myFamily.gif -- refers to the myFamily.gif file within the images subdirectory on the host which supplied the current page.

Relative URLs are very useful, because they allow you to move whole sets of resources around, without having to change all the mutual references, links, etc that they contain.

 

The page was last updated February 19, 2008