Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Lift - Page displays as XML in Firefox rather than HTML

Tags:

scala

lift

I'm trying to get a simple Lift example running and I'm having a strange issue. I am using the Sonatype sample list project here. I modified the HTML slightly, but it wasn't working originally either. The issue I'm having is that when I run the local jetty server and try to access http://localhost:8080 it displays as XML in Firefox 3.6.10 rather than HTML. Note, it displays fine in IE8 but the Content-Type in IE8 is "text/html". I assume Firefox doesn't like the Content-Type "application/xhtml+xml" for some reason. The message in Firefox says:

This XML file does not appear to have any style information associated with it. The document tree is shown below.

Below are the response headers from Firebug:

Expires Thu, 16 Sep 2010 03:55:04 UTC
Content-Length  558
Cache-Control   no-cache; private; no-store
Content-Type    application/xhtml+xml; charset=utf-8
Pragma  no-cache
Date    Thu, 16 Sep 2010 03:55:04 UTC
X-Lift-Version  2.0-scala280-SNAPSHOT
Server  Jetty(6.1.22)

..and the actual response:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
    <title>Lift Test</title>    
</head>
<body>
  <h2>Welcome to your project!</h2>
    <p>  
      <span>Welcome to toto01 at Wed Sep 15 20:55:04 PDT 2010</span>
    </p>
    <script type="text/javascript" src="/ajax_request/liftAjax.js"></script>    
    <script type="text/javascript">
      // <![CDATA[   
      var lift_page = "F586508075515C1K";
      // ]]>
   </script>
</body>
</html> 

Any ideas as to what is going wrong? How would I change the Content-Type in Lift for Firefox if that is the issue?

like image 390
Taylor Leese Avatar asked Sep 16 '10 04:09

Taylor Leese


2 Answers

Alright, it looks like the problem is related to the element not having an xmlns attribute. After changing the XHTML to below it worked fine with the content type as "application/xhtml+xml":

<html xmlns="http://www.w3.org/1999/xhtml">
like image 149
Taylor Leese Avatar answered Oct 29 '22 17:10

Taylor Leese


The problem should be in the use of both application/xhtml+xml content type and XHTML transitional dtd.

https://developer.mozilla.org/en/Mozilla_Web_Developer_FAQ

like image 30
onof Avatar answered Oct 29 '22 17:10

onof