[whatwg] Implement XMLHttpRequest interface subset onHTMLDocument
Weston Ruter
weston at shepherd-interactive.com
Wed Dec 10 09:28:11 PST 2008
On Wed, Dec 10, 2008 at 6:01 AM, Anne van Kesteren <annevk at opera.com> wrote:
> I think we need more use cases than just this (especially since this one
> seems addressed already) to consider this.
>
I agree we need more use cases. You understand that the Accept-Language
header is just one example of a header that needs to be read via scripting;
the use case addressed by "Language JSONP Service" highlights the need for
getRequestHeaders() since its solution is an inefficient (although clever)
hack. Ideally, scripts should be able to access all of the request and
response headers.
Another use case would be getting the "Accept" header to detect if the
client can be served XHTML.
Weston
On Wed, Dec 10, 2008 at 6:01 AM, Anne van Kesteren <annevk at opera.com> wrote:
> On Thu, 30 Oct 2008 08:21:10 +0100, Weston Ruter <
> weston at shepherd-interactive.com> wrote:
>
>> I have an amendment to my proposal. There was a
>> post<http://ajaxian.com/archives/language-jsonp-service>on Ajaxian
>> today about a "Language JSONP Service" which "calculates the
>> users language based on browser headers". This seems like a terrible
>> workaround since the Accept-Language header is sent from the same browser
>> that the script is running in; a script shouldn't have to make an HTTP
>> request just to find out what the browser's request headers are.
>>
>
> Did you read what kriszyp wrote in a comment to that post?
>
>
> Therefore, I propose that in addition to implementing on HTMLDocument the
>> XMLHttpRequest interface subset I initially suggested, I see that it would
>> also be very useful for a script to obtain the request headers that were
>> sent which resulted in the current document as the response. The current
>> version of XMLHttpRequest hints to a future version including a
>> getRequestHeader() method, a method which would complement
>> getResponseHeader(); there could also be a getAllRequestHeaders() method
>> that would correspond to the existing getAllResponseHeaders() method.
>> (Obviously it would not make sense to implement the setRequestHeader()
>> method.)
>>
>> If these two methods ( getRequestHeader() and getAllRequestHeaders() )
>> were
>> implemented, then there would be no need for a "Language JSONP Service"
>> because there would be a better way to get the same result synchronously
>> without any HTTP request, for example:
>> document.getRequestHeader('Accept-Language')
>>
>
> I think we need more use cases than just this (especially since this one
> seems addressed already) to consider this.
>
>
> --
> Anne van Kesteren
> <http://annevankesteren.nl/>
> <http://www.opera.com/>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20081210/1c898b5c/attachment-0001.htm>
More information about the whatwg
mailing list