Lift - 页面在 Firefox 中显示为 XML 而不是 HTML

发布于 2024-09-19 08:07:31 字数 1660 浏览 6 评论 0原文

我正在尝试运行一个简单的 Lift 示例,但遇到了一个奇怪的问题。我正在此处使用 Sonatype 示例列表项目。我稍微修改了 HTML,但它最初也不起作用。我遇到的问题是,当我运行本地码头服务器并尝试访问 http://localhost:8080 它在 Firefox 3.6.10 中显示为 XML,而不是 HTML。请注意,它在 IE8 中显示良好,但 IE8 中的 Content-Type 是“text/html”。我认为出于某种原因 Firefox 不喜欢 Content-Type“application/xhtml+xml”。 Firefox 中的消息显示:

此 XML 文件似乎没有 与相关的任何样式信息 它。文档树如下所示。

以下是 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)

..以及实际响应:

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

关于出了什么问题有什么想法吗?如果这是问题,我该如何更改 Lift for Firefox 中的内容类型?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

终陌 2024-09-26 08:07:31

好吧,看来问题与没有 xmlns 属性的元素有关。将 XHTML 更改为以下内容后,内容类型“application/xhtml+xml”工作正常:

<html xmlns="http://www.w3.org/1999/xhtml">

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">
葵雨 2024-09-26 08:07:31

问题应该出在 application/xhtml+xml 内容类型和 XHTML 过渡 dtd 的使用上。

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

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文