I can declare some info, like encoding and language, in meta-tag or in response-header.
My question: what the best way (maybe them both), for SEO and old-browsers?
meta-tag example:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
(PHP) header example:
header('Content-Type: text/html; charset=utf-8');
What's better ?
A response header is an HTTP header that can be used in an HTTP response and that doesn't relate to the content of the message. Response headers, like Age , Location or Server are used to give a more detailed context of the response.
Metadata is "data about data" and the header in files such as HTML, WAV, MP3, text, etc contain a header, which defines the data within the file.
Request headers contain more information about the resource to be fetched, or about the client requesting the resource. Response headers hold additional information about the response, like its location or about the server providing it.
<meta> tags always go inside the <head> element, and are typically used to specify character set, page description, keywords, author of the document, and viewport settings. Metadata will not be displayed on the page, but is machine parsable.
Do both. The header takes precedence, but if the HTML page is accessed locally, there are no HTTP-headers, so you want to have <meta charset="...">
as a safety mechanism.
Meta http-equiv is little more than a joke. When specifying Content-Type with it, only the charset
section counts for anything, and then only when the real HTTP headers fail to specify the encoding.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With