Forum Moderators: open

Message Too Old, No Replies

Content-type: meta tag vs. HTTP header

Is the meta tag useless?

         

Rickard

3:48 pm on Feb 23, 2007 (gmt 0)

10+ Year Member



In order to instruct a browser what Content-type and encoding a document has, we send it an HTTP header and we include a meta tag. If both are sent, the HTTP header takes precedence and the meta tag is ignored. If this is the case, why include the meta tag at all?

Cheers,
Rickard

[edited by: tedster at 6:58 pm (utc) on Feb. 23, 2007]

Robin_reala

5:29 pm on Feb 23, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld, Rickard!

The meta charset is still useful if you save the page down to a local system where HTTP headers won't be sent.

Rickard

11:26 pm on Feb 23, 2007 (gmt 0)

10+ Year Member



Ok, but is that the only benefit?

Robin_reala

11:58 pm on Feb 23, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Pretty much as far as I can see, but now that I’ve said that I’m sure someone will correct me :)

encyclo

1:54 am on Feb 24, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The HTTP header has priority at all times, but as said above it is good practice to make the document functional out of the context of the server itself. This can be for pages saved to the users's local machine, stored by a web proxy or browser or search engine cache. This is useful when using a charset other than ISO-8859-1.

Adding the meta charset element when you already serve the right header should not be seen as vital, however, and it is unlikely that you will experience many problems if you omit it and rely on the server.

Rickard

4:46 pm on Feb 24, 2007 (gmt 0)

10+ Year Member



Does anyone know how Google's cache handles this? If a document lacks the Content-type meta tag, does it just default to iso-8859-1 or something?

penders

7:31 pm on Feb 24, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Does anyone know how Google's cache handles this?

I'm not sure if this answers your query, but this recent thread discusses Googles cached Content-type meta tags...
[webmasterworld.com...]

Rickard

1:07 pm on Mar 1, 2007 (gmt 0)

10+ Year Member



If anyone's interested, I've investigated this and if a page lacks the meta tag, but sends a HTTP header, Google uses the charset from the HTTP header. So, for Google purposes, at least if you're using UTF-8, the meta tag is useless.

Robin_reala

1:25 pm on Mar 1, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks Rickard, that's useful info.