Forum Moderators: open

Message Too Old, No Replies

Mozilla is displaying source code

Where is the problem?

         

mcibor

8:47 am on Jun 18, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I've created a simple page with some table. It's not completely w3 valid, but works fine on IE and Konqueror. However Mozilla sometimes display the source code instead of the parsed version.

Can anybody tell me where the problem lies?
Michal Cibor

This is part of the code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN">
<html>
<head>
<title>TRADE-TRANS</title>
<link href="../styl/styl.css" type="text/css" rel="stylesheet">
...
</head>...

asquithea

10:21 am on Jun 18, 2005 (gmt 0)

10+ Year Member



Make sure the page is sent with the correct MIME type.

tedster

10:29 am on Jun 18, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can check your server headers here:

[searchengineworld.com...]

Note what the "Content-type" line says. It should be "text/html". Anything else and the html mime type is not configured correctly on the server.

mcibor

5:22 pm on Jun 18, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This is the response. To me seems ok.

Status: HTTP/1.1 200 OK
Date: Sat, 18 Jun 2005 17:19:58 GMT
Server: Apache-AdvancedExtranetServer/2.0.48 (Mandrake Linux/5mdk) mod_perl/1.99_11 Perl/v5.8.3 mod_ssl/2.0.48 OpenSSL/0.9.7c DAV/2 PHP/4.3.4
Content-Length: 9540
Content-Type: text/html
Last-Modified: Sat, 23 Oct 2004 13:04:00 GMT
ETag: "2f00d7-2544-fe333000"
Accept-Ranges: bytes
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive

Moreover it doesn't happen all the time, just after few reloads (randomly). Can it be that server is quite slow (P3 500MHz)?

Best regards
Michal Cibor

asquithea

5:38 pm on Jun 18, 2005 (gmt 0)

10+ Year Member



Still on the MIME type theme, how about installing the LiveHTTPHeaders plugin. Browse around until you hit the problem, and then look at the HTTP headers recorded for that page.

mcibor

3:23 pm on Jun 19, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



On working:
Content type: text/html; charset=iso-8859-2

on not working:
Content type: text/plain; charset=iso-8859-2

However only Mozilla shows that. The same (non working) site in Firefox shows text/html (and still not works).

However if the server really sends that plain, then how can I correct it? It happens randomly. Is there a way to enforce it?

Best regards
Michal Cibor

kaled

11:00 pm on Jun 19, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The doctype is wrong (frameset). Perhaps this is the cause of the problem.

Kaled.

tedster

8:15 am on Jun 20, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It might be related to the frameset dtd (which is not actually "wrong" per se) but I am suspecting soemthing else.

1. Is the page dynamic in some way?
2. Are you doing some kind of content negotiation?

In any case, instead of trying to untangle the server config, maybe first try adding a Content-type meta tag to the html page in the <head> section.

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2">

That should stabilize things.

kaled

11:50 am on Jun 20, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If the http header includes
Content-Type: text

but the html includes
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2">

the source code may be displayed since the browser may not begin parsing the text and won't read the meta tag.

Of course, browsers may treat the http header Content-Type: text as provisional (until html or whatever is detected). I believe some browsers do this, but Firefox may not.

Kaled.

mcibor

1:22 pm on Jun 21, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



1. The page isn't dynamic, but there's php running
2. There's no content negotiation - it's pure html

After your note I added the <meta, but it didn't help.
Maybe if I enforce the header with php it will do some good. I'll try and let you know the result.

The queerest thing is that it happens randomly
If anybody has some more ideas please feel free to answer - I'm open to anything now

Best regards
Michal Cibor

jdkuehne

5:36 pm on Jun 21, 2005 (gmt 0)

10+ Year Member



When this happened to me it was because I was not using a full doctype. See the discussions elswhere in this forum

mcibor

9:16 am on Jun 22, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It didn't help, but at least I found out it has nothing to do with the html.
I added few lines of php to send headers manually:
<?php
header("HTTP/1.1 200 OK\n");
header("Cache-Control: private\n");
header("Content-Type: text/html\n");
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

And now the appearance of the source code happens less frequently, but shows unparsed php as well, and that's not good.
Can you tell me if it can have something to do with the slowness of the server? I can't find any other answer why this may be happening (the file seems to be opened without apache :/, strange!)

Best regards
Michal Cibor

PS. If you may have any other ideas, please write!