Forum Moderators: open

Message Too Old, No Replies

Question about the content-type meta-tag

         

jozomannen

6:27 pm on Sep 11, 2005 (gmt 0)

10+ Year Member



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

1. Why I should use this meta-tag?

2. Is it correctly written? (just copied it from another site)

3. I'm programming in transitional xhtml, should I use content"text/xhtml" instead?

Robin_reala

6:52 pm on Sep 11, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This meta element replicates headers that are sent by the server along with the html file. The browser can use this element if the HTTP headers are missing (afaik). Your code appears to be fine (assuming you're using that encoding - I usually use UTF-8). text/xhtml isn't a valid media type; the correct media type for xhtml is application/xhtml+xml but this isn't accepted by IE, so sticking with text/html is the right thing for you. Remember that by using text/html with xhtml you're not getting the full benefits of xhtml, but that's a thread in itself :)

encyclo

6:56 pm on Sep 11, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The meta tag is quite correct as you have given it. The charset is vital as it defines the character encoding for the page - whether the text is in a western European language (such as English, French) or something else (Arabic, Russian, Japanese, etc.). The charset ISO-8859-1 is an encoding suitable for most western European languages. Note that the trailing slash at the end is for XHTML only.

should I use content"text/xhtml" instead?

No, there is no such MIME type as

text/xhtml
, and anyway you are almost certainly serving your transitional XHTML as
text/html
- there is an
application/xhtml+xml
MIME type, but it is unsupported by Internet Explorer and cannot be set via a meta tag anyway.

<added>Too slow!</added>

jozomannen

7:05 pm on Sep 11, 2005 (gmt 0)

10+ Year Member



Ok, then I just use it as it is =)

Thanks for the help.