views:

107

answers:

5

I copied one of the html pages in a project and just changed the extension from html to php. The rendering is identical in all browsers but IE. It seems that IE treats the pages differently based on the extension.

I checked the HTTP headers and they are the same for both pages. Did anyone have the same problem?

+2  A: 

Make sure you aren't in Quirks mode. Most often this has been caused for my by having text before the <doctype>.

Darryl Hein
I most often run into it with error messages creeping in up there.
D_N
+2  A: 

PHP isn't configured to auto append or prepend anything to your file, is it? Long shot, but worth checking...

(see the Data Handling section of this page)

ZombieSheep
A: 

What versions of the browsers are you using? Older versions of IE produced some non-conforming output, especially connected to CSS. (are you using CSS?)

It is quite common for some elements to be a little different in different browsers. It is what makes web coding fun (?!) and a challenge.

And, as Darryl asked, what exactly is different?

Psychic
He's actually saying this is difference in rendering the same file in the same browser, with the only difference being the file extension.
ZombieSheep
He's not saying 'what' is different. Just saying a page is different doesn't help. Is it a table? A div? Font styles? Borders/margins? What specific part of the page is being rendered different. It would help in narrowing down the cause to know exactly what is wrong.
Psychic
+2  A: 

I would start by verifying the responses are the same. Try the following, in order:

  1. Keep the extension (.php) and configure your web server to serve it just like any html page. Check if the page renders differently. If it does, it's not the extension.
  2. Get the raw response (using wget -S, for example) and compare it to the response of the html page.
  3. Override the headers with php (using header()) until you find the one that is responsible for the change.

I really doubt it's the extension, it must be something in the headers.

soulmerge
A: 

Rather than browsing the pages via HTTP to a web server, try File->Open. That will at least eliminate or incriminate the web server.

Denis Howe