Re: Hyperlinks and content negotiation

On Oct 16, 2009, at 9:19 AM, Mike Kelly wrote:

> HTML does not currently provision for hyperlinks to indicate a  
> specific content-type preference for the Accept header of a given  
> request.

Yes, it does, at least to the extent that it is actually desirable.
HTML provides for that in the element or attribute semantics, along
with the relation value in rel attributes.

That is why the accept header will typically be different for
an <a href="foo"> request versus an <img src=foo"> request.

> This is an important feature for developers who wish to leverage  
> HTTP content-negotiation, and require HTML hyperlinks that specify  
> requests to URIs with a specific Accept header preference. There are  
> use cases in which the distinction between a resource's  
> representations are relevant to the flow of an html driven  
> application, e.g. the difference to a browser between an atom and an  
> html representation of a blog resource.
>
> <a href="/blog" type="text/html">My blog (HTML)</a>
> <a href="/blog" type="application/atom+xml">My blog (Atom Feed)</a>

That would be contrary to the design goals of content negotiation.

The purpose of conneg is to remove such explicit type indications
from the distributed content (HTML) so that such coupling of
standards would not be embedded in the web for eternity.  The rel
attribute should be used to state the purpose of a generic link
so that the user agent can adjust its acceptance criteria
according to that purpose, not according to some specific
media format.  Existing formats are revised or replaced by
alternative formats far more often than the relation semantics
(and names) change, and giving the user agent the flexibility
to support new media types without changing existing content
is critical to enabling deployment of new types.

....Roy

Received on Tuesday, 20 October 2009 00:47:29 UTC