Please can I clarify some thinking here:
Quirksmode is invoked if no doctype is specified.
but
When served from localhost IE appears to go into quirksmode regardless of doctype. Please can this be confirmed and can someone explain why this is the case.
however
When served from localhost and IE goes into quirksmode regardless of doctype this can be overridden by including a meta tag in the first line of the head
<meta http-equiv="X-UA-Compatible" content="IE=edge">
This doesn't work for me ... have I got the syntax wrong?
The meta in the head will only ever be applied when served from localhost? Is this true if so why.
At the moment everything looks fine in FF Chrome Opera etc whether served from localhost or across the net.
But I just get quirks mode in IE
My doctype is
<!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">
Finally is there a relationship between charset and quirksmode?
I have been using
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
On apache with apache config set to default to UTF-8
Two things, you can try IE=8 etc....
You may also want to check doctype; although, it looks correct you might have hidden characters etc.... try using a basic editor that will show hidden characters.
For VI you can look at: http://www.chrispian.com/quick-vi-tip-show-hidden-characters/.
This would be a first step for me.
Short answer
Is where it goes wrong, because you say it's
text/html
while your doctype is xhtml. You should useapplication/xhtml+xml
.Longer answer
It seems to me that you have not properly researched what XHTML actually is. This is a very strange kind of document. XHTML was supposed to be an improvement on traditional HTML but it never really got popular and generally it's not recommend that you use it unless you have very specific reasons.
Have a look at this web site. Some important sections:
And here's your problem specifically:
Quirks Mode is quirky, and you should not rely on anything particular regarding it. The situations where it is triggered are browser-dependent, but if you have seen an XHTML doctype, conforming to XHTML specs, to trigger it, then it’s probably a mistake in observations. You might have e.g. some stuff before the doctype. Ditto for the magic
meta
tag regarding IE.You may have the syntax wrong, but not in the snippets posted.
Or the issue could be caused by some of the IE8 and IE9 complications in doctype sniffing.
There is no relationship between charset and Quirks Mode.
I wanted to summarise the findings from this question.
To switch off compatibility mode in IE9
Main points for changing code
So actions completed to resolve problem.
Use
<!Doctype html>
ensuring that the html document commences with this. N:B this does not mean that this has to be the first line of the HTML. php includes can precede it.In the
<head>
Use<meta charset="UTF-8">
<?php header("content-Type: text/html; charset=utf-8"); ?>