Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Template Questions /

XHTML Doctype removed in IE


Reply


2 Posts   1038 Views

Avatar
Thez

Community Member, 1 Post

5 February 2011 at 12:12am

In IE the XHTML DocType I have is replaced by the standard HTML 4 Doctype, causing the site to look radically different.
I've tried setting ContentNegiotator off in both the page's php file and _config and have the <?xml before the DOCTYPE but it is still being replaced.

How can I set it so that the DOCTYPE is left as it is in the .ss file?

Avatar
Devlin

Community Member, 217 Posts

12 February 2011 at 5:08am

Edited: 12/02/2011 5:26am

Re: How can I set it so that the DOCTYPE is left as it is in the .ss file?

IE expects that the *first* line is the Doctype. You have probably the "<?xml version="1.0" encoding="UTF-8"?>" tag there.
This tag is unnecessary if you make sure the server delivers utf-8 per default.
You can do that via php:

header("Content-Type: text/html; charset=utf-8");


...or .htaccess:

AddDefaultCharset utf-8


... or html:

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
</head>

Edit: Silverstripe already sends a proper utf-8 content-type per default. So just delete the "<?xml version="1.0" encoding="UTF-8"?>" tag or whatever you have there in the first line and IE will stop replacing the doctype.