Jump to:

3435 Posts in 1026 Topics by 866 members

Template Questions

SilverStripe Forums » Template Questions » XHTML Doctype removed in IE

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 979 Views
  • Thez
    Avatar
    Community Member
    1 Post

    XHTML Doctype removed in IE Link to this post

    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?

  • Devlin
    Avatar
    Community Member
    215 Posts

    Re: XHTML Doctype removed in IE Link to this post

    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.

    979 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.