Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Meta tag not in first 1024 bytes

Tags:

meteor

Caveat: Before someone goes and marks this as duplicate of this, please understand that it is not. The accepted answer is exactly what I am doing, yet I am facing the following issue.

HTML file in client folder looks like this:

<head>
    <meta charset="utf-8"/>
    <title>blah-blah</title>
    ---

The message I am getting in the firebug console is:

The character encoding declaration of the HTML document
was not found when prescanning the first 1024 bytes of 
the file. When viewed in a differently-configured browser, 
this page will reload automatically. The encoding
declaration needs to be moved to be within the first 
1024 bytes of the file.

When I do a view source, between the head and the meta charset element, I see a whole bunch of link stylesheet and script tags.

If I remove the meta charset, I get this in the firebug console:

The character encoding of the HTML document was not 
declared. The document will render with garbled text 
in some browser configurations if the document 
contains characters from outside the US-ASCII range. 
The character encoding of the page must to be declared 
in the document or in the transfer protocol.

How do I get the meta charset tag to appear right after the head?

like image 480
Kinjal Dixit Avatar asked Sep 03 '12 08:09

Kinjal Dixit


People also ask

Does meta have to be in head?

<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.

Does meta charset require UTF-8?

Furthermore, most browsers use UTF-8 by default if no character encoding is specified. But because that's not guaranteed, it's better to just include a character encoding specification using the <meta> tag in your HTML file. There you have it.

Can I place meta tag in body?

META tags are only allowed within HEAD (just like, say, TITLE) so by putting it into a BODY, you're essentially creating an invalid markup.


2 Answers

What I did was edit /usr/lib/meteor/app/lib/app.html.in, and add the meta charset line so that the file now looks like this:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>    //**Added this line**
{{#each stylesheets}}  <link rel="stylesheet" href="{{this}}">
{{/each}}
...

And of course I removed the meta charset line from my html files.

I think right now, this would be the way to go and this will be resolved in future revisions.

like image 164
Kinjal Dixit Avatar answered Oct 02 '22 04:10

Kinjal Dixit


I had the problem in IE to force to use the latest version. I had to add

<meta http-equiv="x-ua-compatible" content="IE=edge">

Directly behind the tag. And app.html.in seems not to be used anymore.

So I did this on tools/latest/tools/bundler.js

Line 783

'<head><meta http-equiv="x-ua-compatible" content="IE=edge">\n');

That forced it to add it in the html boilerplate.

like image 38
Iwan van Staveren Avatar answered Oct 02 '22 04:10

Iwan van Staveren