Firefox/Opera 显示 HTML 页面源而不是内容?
我使用 LUA(corona 环境)创建了一个简单的 HTML 服务器
无论如何,从 Safari/Chrome 连接时,页面显示正常, 但对于 Opera/Firefox,我得到的是显示的源代码?
我是否必须发送一种 PreHeader 或者可能是什么原因。
例如,
<html>
<body>
hello <strong>test</strong> how are you
</body>
</html>
Safari/Chrome 确实按预期显示:“你好 test 你好吗”,
但 Opera/Firefox 确实显示源本身,如上面的示例!!?
任何想法
更新: 现在我实现了元标记内容标题...仍然相同! Firefox/opera 确实显示源代码而不是内容。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
</head>
<body>
testa asdfa asf asdf asdf asdf
</body>
</html>
I created a simple HTML Server with LUA (corona environment)
Anyhow while connecting from Safari/Chrome the Page is displayed fine,
but with Opera/Firefox, I get instead the Source Code shown instead??
Do i have to send kind a PreHeader or what can be the reason.
For example
<html>
<body>
hello <strong>test</strong> how are you
</body>
</html>
Safari/Chrome does show as expected just: " hello test how are you "
But Opera/Firefox does show the source itself as example above!!?
Any Ideas
Update:
Now I implemented a meta tag Content Header.... still the same !!
Firefox/opera do show the source instead the content.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
</head>
<body>
testa asdfa asf asdf asdf asdf
</body>
</html>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在HTTP响应(来自服务器)中,您需要发送Content-Type标头,即
In the HTTP response (from the server), you need to send the Content-Type header, i.e.
好吧..解决了..
必须
先发送
ok.. solved it...
had to send
before anything else
您的问题几乎肯定是因为您尚未发送
Content-type
标头。您会想尝试以某种方式发送它。将其设置为text/html
。Your problem is almost certainly because you have not sent the
Content-type
header. You'll want to try to send it somehow. Set it totext/html
.