开发者

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

开发者 https://www.devze.com 2022-12-21 15:27 出处:网络
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 t

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 extensi开发者_如何学编程on.

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


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


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)


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.


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?


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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消