There is a blank section at the top of the html page. Check the console and find & amp; #65279 characters under the body. The cause and solution are as follows,

Source: Internet
Author: User

There is a blank section at the top of the html page. Check the console and find the & #65279 characters in the body. The cause and solution are as follows,
There is a blank section at the top of the html page. Check the console and find the & #65279 characters in the body. The cause and solution are as follows:

Analysis:

It turns out that BOM was added during page encoding. The back-end data of this page is mainly in the PHP language. For PHP, BOM is not taken into account during design ,, does not ignore the three characters at the beginning of the BOM for a UTF-8-encoded file, and uses the BOM as part of the body at the beginning of the file. Because it must be in the <? Or <? The code after php is executed as PHP code, so the three characters will be output on the page. The display effect depends on the browser, which is generally a blank line or garbled code. Because these three characters exist at the beginning of html, even if the top padding of the page is set to 0, the whole web page cannot be placed close to the top of the browser. Due to the restriction of the COOKIE sending mechanism, the COOKIE cannot be sent to files whose names start with BOM (because PHP has already sent the file header before the COOKIE is sent ), therefore, the logon and logout functions are invalid. All functions dependent on cookies and sessions are invalid.

Solution:

When editing or changing any text files, you must use an editor without adding BOM. The editor in linux should have no such problem. In WINDOWS, do not use notepad or other editors.

The recommended editor is:

1. UltraEdit (you need to cancel the related options of 'add BOM );
2. Dreamweaver (you need to cancel the related options of 'add BOM)I used this to solve the problem.;
3, Notepad (need to be "converted to a UTF-8 without BOM") and so on;
4. For files that have added BOM, to cancel, you can save it again with the above Editor (Editplus needs to be saved as gb first, then saved as UTF-8 .).

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.