Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can you have multiple http-equiv meta properties?

Tags:

html

I don't really understand what it does, but it is set in my project to:

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

I want to force compatibility mode in IE8 off, cos people keep turning it on and it breaks stuff. It's software used on the intranet where everyone has IE8.

I read that I should put this in:

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

to force it off. However, should I replace the first line with this one, have both, or do something else entirely?

like image 330
NibblyPig Avatar asked Nov 04 '09 14:11

NibblyPig


People also ask

Can you have more than one meta tag?

Yes, this is definitely possible and valid (and actually most of the times even necessary). Basically, you can have an arbitrary number of them, as long as you put all of them into the head section of your website. Additionally you should watch out not to have multiple meta elements for the same concern.

Is meta HTTP-equiv necessary?

<meta http-equiv="">The http-equiv element is considered obsolete and should not be used. To specify the content type of a document, use the charset attribute of the meta element instead.

What is meta HTTP-equiv?

The http-equiv attribute provides an HTTP header for the information/value of the content attribute. The http-equiv attribute can be used to simulate an HTTP response header.

What are valid values of HTTP-equiv?

http-equiv values Other values that can be used with the http-equiv attribute include: content-security-policy. content-length. content-encoding.


2 Answers

Just put those two lines in the head, don't combine them.

You can have as many meta http-equiv tags as you want.

The sames goes for normal meta tags.

like image 127
CodeJoust Avatar answered Sep 20 '22 07:09

CodeJoust


Yes, don´t worry. You may have multiple http-equiv lines. In fact, on this case what you are doing is setting 2 different variables:

  1. Content-Type = "text/html; charset=iso-8859-1"
  2. X-UA-Compatible = "IE=EmulateIE8"

    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> 
    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" />
    

In my pages I am setting my X-UA-Compatible as:

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

I think IE=100 has the same effect as IE=EmulatesIE8

like image 34
Haroldo Maranhão de Oliveira Avatar answered Sep 19 '22 07:09

Haroldo Maranhão de Oliveira