[OT] absolute vs. relative URI

Marko Rauhamaa marko at pacujo.net
Fri Jan 23 16:18:05 CET 2015


Grant Edwards <invalid at invalid.invalid>:

> I'm not an HTLM/HTTP guru, but I've tinkered with web pages for 20+
> years, and for links within sites, I've always used links either
> relative to the current location or an absolute _path_ relative to the
> current server:
>
>   <a src='/Whatever'>Whatever</a>
>
> I've never had any problems with links like that.  Is there some case
> where that doesn't work right and I've just been stupidly lucky?

An ancient HTML spec (<URL: https://tools.ietf.org/html/rfc1866>)
specifies:

    HREF
        gives the URI of the head anchor of a hyperlink.

It refers to the URI spec (<URL: https://tools.ietf.org/html/rfc1630>):

    Partial (relative) form
       Within a object whose URI is well defined, the URI of another
       object may be given in abbreviated form, where parts of the two
       URIs are the same. This allows objects within a group to refer to
       each other without requiring the space for a complete reference,
       and it incidentally allows the group of objects to be moved
       without changing any references.

       [...]

       The rules for the use of a partial name relative to the URI of
       the context are: [...]

Bottom line: you are safe.


Marko



More information about the Python-list mailing list