diff options
author | Bharat Mediratta <bharat@menalto.com> | 2008-11-24 07:50:20 +0000 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2008-11-24 07:50:20 +0000 |
commit | b79ce414ded73012001823a2e0e2c0feae0d5671 (patch) | |
tree | 455896b1e2c98936073b663c91e9e9989855110a /core/helpers/rest.php | |
parent | c812d2a9314eec3d73f9408cf1f3938edc675b0d (diff) |
Detect browsers that prefer XHTML (Chrome!) and normalize it to HTML
so that we don't ship XML down to Chrome.
Diffstat (limited to 'core/helpers/rest.php')
-rw-r--r-- | core/helpers/rest.php | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/core/helpers/rest.php b/core/helpers/rest.php index f1c191c2..bb2e8f1a 100644 --- a/core/helpers/rest.php +++ b/core/helpers/rest.php @@ -76,10 +76,16 @@ class rest_Core { public static function output_format() { // Pick a format, but let it be overridden. $input = Input::instance(); - return $input->get( + $fmt = $input->get( "_format", $input->post( "_format", request::preferred_accept( - array("html", "xml", "json")))); + array("xhtml", "html", "xml", "json")))); + + // Some browsers (Chrome!) prefer xhtml over html, but we'll normalize this to html for now. + if ($fmt == "xhtml") { + $fmt = "html"; + } + return $fmt; } /** |