O'Reilly logo

Learning WML, and WMLScript by Martin Frost

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Appendix A. Absolute and Relative URLs

When URLs were originally invented, each specified everything needed to find some resource, including the protocol to use, the path to the resource, and any extra parameters required by the protocol or resource.

A URL like this is known as an absolute URL , because it contains all this information. It can be passed around freely without needing any extra context to fetch its resource.

Absolute URLs are a problem, however, when you have a group of resources that all reference each other, such as the group of web pages that make up a complete web site. If you want to move this site to a different server, you have to go through every page looking for URLs on the old server, and change these to point to the new server.

The problem can occur even without moving the pages from one server to another. Many people test their web sites locally on their own computer, using file URLs . If these sites use absolute URLs for their cross references, all the links have to be changed before the site can be uploaded to the main server. (Apart from being inconvenient, this is also a place where errors can be introduced.)

The solution to this problem is to allow parts of the URL to be omitted. Such partial URLs are known as relative URLs . Alone, they don’t contain enough information to locate a resource; they must be converted into absolute URLs by adding the missing parts. This process is known as resolving .

A URL is resolved relative to an existing absolute URL, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required