【问题标题】:localhost is not opening in firefox but working fine in IE8localhost 没有在 Firefox 中打开,但在 IE8 中工作正常
【发布时间】:2011-09-07 10:50:05
【问题描述】:

我正在使用 apache 网络应用程序。我用这个完成了一个项目,它在 IE8 中运行良好。现在我在 firefox、opera 和 chrome 中尝试了同样的方法,结果是源代码。

当我输入 http://localhost/ 时,结果,

<html>
<head>
<title>X2A.biz</title>
<script type="text/javascript">
window.location.href = "../pages/X2AFrame.htm"
</script>
</head>
<body>
</body>
</html>

我也尝试过使用 html 过渡文档类型。在 X2AFrame.htm 中,我有框架集。

有人可以帮忙吗?请...

【问题讨论】:

    标签: apache firefox localhost


    【解决方案1】:

    这是因为您没有正确配置 Web 服务器 - 它使用 MIME 类型 text/plain 而不是 text/html 提供此页面。 IE 会进行内容嗅探并检测到您为其提供了 HTML 页面,而其他浏览器则不会(符合标准的方法)。所以你需要修复你的 web 服务器的配置,在 Apache 中你可以使用AddType directive:

    AddType text/html .htm
    

    【讨论】:

    • 这些是我在httpd.conf中添加的东西,AddType application/x-compress .Z AddType application/x-gzip .gz .tgz AddType application/x-httpd-php .php AddType text/ html .htm AddCharset UTF-8 .utf8
    【解决方案2】:

    Firefox 和 Chrome 在其中支持 Javascript 调试器。对于 firefox,您可以安装 firebug 扩展,但它已经存在于 chrome 中,所以:

    在 chrome 中打开你的页面,按 ctrl+shift+j 打开一个 javacsript 调试器,然后查看那里的错误,它应该会指出问题所在的方向。

    【讨论】:

    • 我在萤火虫中试过。但它显示语法正确。>
      <html> <头> <title>X2A.biz</title> <脚本类型="文本/javascript"> window.location.href = "../pages/X2AFrame.htm" </script> </头> <身体> </html> 
    • mine.types 有什么需要改变的吗?我已经添加了 text/html html htm 并且我在 httpd.conf 文件中添加了 AddType text/html .html AddType text/html .htm。
    • 嗨 wladimir 感谢您的帮助。我在 httpd.conf 文件中发现了错误。 DefaultType text/PlainTextwas there.i 将其修改为 DefaultType text/html.now 页面正在打开 infirefox、chrome、opera。但还有一个问题 CSS 不适用..
    • 我检查了 conf 文件并添加了,AddType text/css .css and in mime.types 还有 text/css css 在那里。但是仍然面临着CSS问题。有人可以帮忙吗?请,,,
    【解决方案3】:

    朋友们,我发现了这个问题... 在 httpd.conf 文件中,LoadModule mime_module modules/mod_mime.so 为我注释了...这就是问题..

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-06-22
      • 1970-01-01
      • 2011-06-07
      • 2014-10-28
      • 1970-01-01
      • 2016-03-02
      • 2020-09-29
      • 1970-01-01
      相关资源
      最近更新 更多