Re: [whatwg] Accept header

On Wed, Jul 30, 2014 at 11:35 AM, Ian Hickson <ian@hixie.ch> wrote:

> On Wed, 30 Jul 2014, Anne van Kesteren wrote:
> >
> > it would be desirable to have Accept / Accept-Language be set by APIs,
> > such as <img>. XMLHttpRequest already does this (unless a developer
> > added those headers), see http://xhr.spec.whatwg.org/
> >
> > If we are eventually going to expose something like a "Fetch" object for
> > each API that can issue a fetch it would seem best if these details were
> > defined at the API-level.
> >
> > I guess for now I'll add some notes to the network-level bits of Fetch
> > to indicate Accept / Accept-Language cannot be set at that point by the
> > user agent.
>
> There's three ways that I see:
>
>  1. Expose it on a "fetch" object available from all the places that can
>     do fetches. (HTMLImageElement, XMLHttpRequest, StyleSheet, etc)
>
>        var img = new Image();
>        img.src = 'foo.png';
>        img.fetch.doWhateverWithTheAcceptHeader('foo');
>


At what point is the fetch actually being initiated? It's possible that
fetch will offer some things which can be done post-request (eg,
dynamically changing the spdy priority), but the accept header may need to
be specified pre-request.

Note that "Accept" _should_ probably be set by the UA for images, since
> the author can't know what image types are supported.
>

It's possible a site could want to *remove* headers. For example, maybe a
site wants to A/B test the performance of using webp. I don't think this is
an important use case -- there are many other ways a site could accomplish
this task.

Received on Wednesday, 30 July 2014 18:44:16 UTC