- From: Ian Hickson <ian@hixie.ch>
- Date: Wed, 30 Jul 2014 18:35:29 +0000 (UTC)
- To: Anne van Kesteren <annevk@annevk.nl>
- Cc: WHATWG <whatwg@whatwg.org>
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'); 2. Expose a dedicated attribute on relevant elements, that sets the default fetch settings, either using some generic syntax: <img src="foo.png" fetchoptions="{whatever:{accept:'foo'}}"> ...or some nicer dedicated syntax: <img src="foo.png" fetchoptions="accept: foo; whatever: bar"> 3. Have multiple dedicated attributes: <img src="foo.png" accept=foo whatever=bar> These are not mutually exclusive. I would avoid adding the non-API sugar versions (content attributes, especially the dedicated ones) for anything that didn't have significant compelling use cases. Note that "Accept" _should_ probably be set by the UA for images, since the author can't know what image types are supported. -- Ian Hickson U+1047E )\._.,--....,'``. fL http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,. Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'
Received on Wednesday, 30 July 2014 18:35:53 UTC