最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - The character encoding declaration of the HTML document was not found - Stack Overflow

programmeradmin3浏览0评论

randomly getting this issue e up in my web console of firefox (is the js tab)

Its only just appeared and cant link it to any changes i have made.

The full error is:

The page was reloaded, because the character encoding declaration of the HTML document was not found when prescanning the first 1024 bytes of the file. The encoding declaration needs to be moved to be within the first 1024 bytes of the file.

Or this one:

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.

The issue points to this line:

<meta http-equiv="Content-Type" content="text/html" charset="UTF-8" />

To me, that meta tag is okay? Any help as i think it is conflicting and causing issues with other things.

Craig

randomly getting this issue e up in my web console of firefox (is the js tab)

Its only just appeared and cant link it to any changes i have made.

The full error is:

The page was reloaded, because the character encoding declaration of the HTML document was not found when prescanning the first 1024 bytes of the file. The encoding declaration needs to be moved to be within the first 1024 bytes of the file.

Or this one:

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.

The issue points to this line:

<meta http-equiv="Content-Type" content="text/html" charset="UTF-8" />

To me, that meta tag is okay? Any help as i think it is conflicting and causing issues with other things.

Craig

Share Improve this question edited Jul 21, 2014 at 22:08 Lovelock asked Jul 21, 2014 at 21:57 LovelockLovelock 8,08519 gold badges93 silver badges194 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 13

Charset is a parameter of the content-type, not a separate attribute:

<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />

Or, if you want to use the HTML 5 style:

<meta charset="utf-8">

You should also note the error message:

not found when prescanning the first 1024 bytes of the file

You might need to move the meta tag up the document. Ideally, it should be the first tag inside the <head>.

I get this error message in Firefox. When I "pagespeed DisableFilters add_head;" in my nginx settings, it goes away.

发布评论

评论列表(0)

  1. 暂无评论