From b79ce414ded73012001823a2e0e2c0feae0d5671 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Mon, 24 Nov 2008 07:50:20 +0000 Subject: Detect browsers that prefer XHTML (Chrome!) and normalize it to HTML so that we don't ship XML down to Chrome. --- core/helpers/rest.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'core/helpers') 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; } /** -- cgit v1.2.3