Bad value X-UA-Compatible for attribute http-equiv

2019-01-10 08:28发布

I have used the same meta that HTML5 Boilerplate is using, and the W3C HTML validator complains:

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

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

What is wrong with this meta tag?

8条回答
不美不萌又怎样
2楼-- · 2019-01-10 09:11

If you download/build the validator src code, you can add support yourself.

Add the following to a file such as html5-meta-X-UA-Compatible.rnc) Then include it in html5full.rnc.

I did this and it works nicely for validating.

meta.http-equiv.X-UA-Compatible.elem =
  element meta { meta.inner & meta.http-equiv.X-UA-Compatible.attrs }
  meta.http-equiv.X-UA-Compatible.attrs =
    ( common.attrs.basic
      & common.attrs.i18n
      & common.attrs.present
      & common.attrs.other
      & meta.http-equiv.attrs.http-equiv.X-UA-Compatible
      & meta.http-equiv.attrs.content.X-UA-Compatible
      & ( common.attrs.aria.role.presentation
        | common.attrs.aria.role.menuitem
        )?
    )
    meta.http-equiv.attrs.http-equiv.X-UA-Compatible = attribute http-equiv {
      xsd:string {
        pattern = "X-UA-Compatible"
      }
    }
    meta.http-equiv.attrs.content.X-UA-Compatible = attribute content {
      xsd:string {
        pattern = "IE=((edge)|(EmulateIE(7|8|9|10))|7|8|9|10|11)(,chrome=(1|0))?"
      }
    }

common.elem.metadata |= meta.http-equiv.X-UA-Compatible.elem
查看更多
等我变得足够好
3楼-- · 2019-01-10 09:15

Please remove ,chrome=1 from meta tag it will working fine. With validator:

<meta http-equiv="X-UA-Compatible" content="IE=edge" />
查看更多
登录 后发表回答