18 Feb 17:41
Re: HTML with REST
Rob Heittman <rob.heittman <at> solertium.com>
2008-02-18 16:41:45 GMT
2008-02-18 16:41:45 GMT
This legacy browser behavior is frustrating in the extreme. Why in heaven's name would a tool meant primarily for viewing HTML, request XML as a higher quality representation? Just goes to show how uber-excited everybody was about XML once upon a time. You know, because in the future, all web pages will someday be XML with a reference to an XSL stylesheet, not HTML.
Choosing a different MediaType for your XML, that the browser doesn't ask for, is the usual solution.
Another workable solution I have found -- if you are using XML and will get criticized for making up MIME types -- is to expose the browser-friendly HTML variant by itself on a distinct URI (e.g. person.html). That's sloppy too, just in a different way.
Now, packaging your data with JSON instead of XML will avoid the issue altogether, without making up MIME types =)
- R
On 2/18/08, Stephan Koops <Stephan.Koops <at> web.de> wrote:
if a browser requests to a REST server, some browsers (Firefox and IE
for example, Opera not) requests text/xml and application/xml with a
higher quality than text/html.
RSS Feed