Meta tag not in first 1024 bytes

2020-04-04 05:41发布

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?

标签: meteor
2条回答
女痞
2楼-- · 2020-04-04 06:04

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.

查看更多
家丑人穷心不美
3楼-- · 2020-04-04 06:12

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.

查看更多
登录 后发表回答