Ovidiu Pacurar
Ovidiu Pacurar

Reputation: 8209

.php vs .html . Why is IE rendering them differently?

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?

Upvotes: 0

Views: 282

Answers (6)

Stephen Paul
Stephen Paul

Reputation: 39015

Just add:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

at the top of your source file

Upvotes: 0

Denis Howe
Denis Howe

Reputation: 2411

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

Upvotes: 0

soulmerge
soulmerge

Reputation: 75704

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.

Upvotes: 2

Dave
Dave

Reputation: 1755

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?

Upvotes: 0

ZombieSheep
ZombieSheep

Reputation: 29953

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)

Upvotes: 2

Darryl Hein
Darryl Hein

Reputation: 144967

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

Upvotes: 3

Related Questions