HTML 5 validación w3c


Validé mi sitio web usando validator.w3.org

Reportó el siguiente error:

Line 5, Column 67: Bad value X-UA-Compatible for attribute http-equiv on element meta.
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" >

Si no incluyo esa META etiqueta, todos los visitantes de IE9 verán mi sitio web en modo Peculiaridades, y quiero evitar eso.

Cualquier ayuda sería muy apreciada!

Author: John, 2011-11-04

7 answers

Siempre puede poner la configuración compatible con X-UA en las cabeceras HTTP reales. La forma en que lo haga depende del servidor web que esté utilizando y del marco de trabajo del lado del servidor que esté utilizando, si lo hubiera.

 12
Author: Alohci,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2011-11-04 14:10:07

El mismo problema aquí, pero mi solución es agregar la siguiente línea a mi.archivo htaccess:

Header set X-UA-Compatible "IE=edge"

Funciona muy bien para mí...

 12
Author: GreenOrk,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2012-06-05 18:41:14

Solo tendrá que aceptar el hecho de que si desea soporte de IE, tendrá que renunciar a la puntuación de validación perfecta.

Aunque está bien, validity != quality

 8
Author: Madara Uchiha,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2011-11-04 11:35:45

La solución es muy simple y el tema puede incluir esto fácil en las plantillas de características solo tienes que abrir / templates/YOUR TEMPLATE/warp/systems/themes / head.php

De

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

A

<!--[if IE]>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<![endif]-->
 5
Author: Akm Ajay K Maheshwari,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-08-14 19:35:50

Para las personas que usan PHP, la forma de pasar este parámetro a través de la función de encabezado en PHP:

header('X-UA-Compatible: IE=edge,chrome=1');

Aquí hay un mensaje a con código + explicación.

 4
Author: Lea Cohen,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2012-12-26 08:05:32

Para chicos usando ASP.NET MVC

Una opción es usar el Filtro de acciones en controladores/acciones. Esto ralentiza un poco las respuestas del servidor, pero no conozco los números exactos. Pero es una manera limpia de hacerlo:

///
/// Represents an attribute that is used to add HTTP Headers to a Controller Action response.
///
public class HttpHeaderAttribute : ActionFilterAttribute
{
    ///
    /// Gets or sets the name of the HTTP Header.
    ///
    /// The name.
    public string Name { get; set; }

    ///
    /// Gets or sets the value of the HTTP Header.
    ///
    /// The value.
    public string Value { get; set; }

    ///
    /// Initializes a new instance of the  class.
    ///
    /// The name.
    /// The value.
    public HttpHeaderAttribute(string name, string value) {
        Name = name;
        Value = value;
    }

    public override void OnResultExecuted(ResultExecutedContext filterContext) {
        if(!filterContext.HttpContext.Response.Headers.AllKeys.Contains(Name, StringComparer.OrdinalIgnoreCase))
            filterContext.HttpContext.Response.AppendHeader(Name, Value);
        base.OnResultExecuted(filterContext);
    }
}

Sin embargo, la manera absolutamente mejor y más limpia para mí es usar web.config. Ponga este código en el elemento <system.webServer>:

<httpProtocol>
  <customHeaders>
    <!-- 
                            http://hacks.mozilla.org/2009/07/cross-site-xmlhttprequest-with-cors/
                            Uncomment to serve cross-domain ajax requests

                            <add name="Access-Control-Allow-Origin" value="*" />
                            -->
    <!-- 
                            Force the latest IE version, in various cases when it may fall back to IE7 mode
                            github.com/rails/rails/commit/123eb25#commitcomment-118920
                            Use ChromeFrame if it's installed for a better experience for the poor IE folk 
                            -->
    <add name="X-UA-Compatible" value="IE=Edge,chrome=1" />
    <!-- 
                            Allow cookies to be set from iframes (for IE only)
                            If needed, uncomment and specify a path or regex in the Location directive 

                            <add name="P3P" value="policyref=&quot;/w3c/p3p.xml&quot;, CP=&quot;IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT&quot;" />
                            -->
    <!-- A little extra security (by obscurity) -->
    <remove name="X-Powered-By" />
  </customHeaders>
</httpProtocol>

Obviamente esto solo funciona en IIS7+.

HTH

 2
Author: mare,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2012-06-30 14:16:46

¿Has intentado que no te importe lo que los validadores HTML dicen sobre tu código? Eso normalmente funciona para mí.

 2
Author: Okonomiyaki3000,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-10-21 00:57:34