Where's it go?


#1

I was recommended to go to GTMetrix for a site eval. They made some suggestions, one of which was take the char set OUT of the meta tag. I’d always been told that’s where it goes. Ideas?


#2

This suggestion?

The following resources have no character set specified in their HTTP headers. Specifying a character set in HTTP headers can speed up browser rendering.

Confusion about HTTP headers, <head>, headings eg. <h1>, and <header> is not uncommon.

In this case, the suggestion is not about taking the <meta> out of the <head>, indeed, it should be there. What it is suggesting is that there should be HTTP headers as well.

https://www.w3.org/International/questions/qa-html-encoding-declarations

Always declare the encoding of your document using a meta element with a charset attribute, or using the http-equiv and content attributes (called a pragma directive). The declaration should fit completely within the first 1024 bytes at the start of the file, so it’s best to put it immediately after the opening head tag.

I don’t know how much the lack actually slows the page load down. I suspect it’s negligible at most. But if you want to you can send HTTP headers in different ways. If you’re on a shared host without access to config and ini files sending with PHP is probably the way to do it.

http://php.net/manual/en/function.header.php

Remember that header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP.

http://www.faqs.org/rfcs/rfc2616.html

eg. 14.17

Content-Type: text/html; charset=ISO-8859-4


#3

Was there somewhere else Gtmetrix suggested where or if the charset should be placed?

Did you view their web-page source and see if and where they use charset?


#4

You can set the character set in your .htaccess file, although I’m not sure many people do that.

<off-topic>
Incidentally, I see you are serving both the www and non-www version of your site. You need to add a couple of directives to your .htaccess file to serve just one or the other, depending on which you prefer.
</off-topic>


#5

I notice that your home page is still missing a closing </head> tag, and your other pages have no <head></head> section at all (and no language, charset or title specified). You need to ensure the structure of the page is correct.

I know we sound like a broken record, but I cannot emphasise enough how important it is to validate your code and fix the remaining errors.


#6

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.