[whatwg] Implement XMLHttpRequest interface subset onHTMLDocument

Anne van Kesteren annevk at opera.com
Wed Dec 10 06:01:08 PST 2008


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/>



More information about the whatwg mailing list