Search code examples
pythonhtmlvalidationplonemeta-tags

Fix HTML5 validator error “Bad value X-UA-Compatible..."


I have a web portal in Zope/Plone, and ALL must validate (client requirements). I'm using HTML5. In production, IE "thinks" the Portal is an intranet, so, it forces the compatibility mode.

For fixing this, I have set the typical tag in header:

<meta http-equiv="X-UA-Compatible" content="IE=edge">

But the W3C validator don't like it:

“Bad value X-UA-Compatible for attribute http-equiv on element meta.”

There are several fixes for this, as I can see in JoshuaWinn. But nothing of these applies to Python or Zope/Plone. Is there any way to set the tag in that CMS?

If validator is correct, as I read in this answer... how can I force the standard mode in IE8?


Solution

  • Set the header from the main template; add the following tag to your main_template.pt file to have it include the header on every request that uses the main template:

    <tal:add_x_ua_compatible_header define="dummyresult python:request.response.setHeader('X-UA-Compatible', 'IE=edge,chrome=1')" />