A blank address appears at the top of the page in the Chrome browser

Source: Internet
Author: User

Recently encountered page under Chrome, there is a blank question at the top. Later know is the problem of BOM head.

1. What is a BOM header?

The BOM signature means to tell the editor what encoding the current file is for easy editor identification, but the BOM does not appear in the editor, but produces output, just like a blank line. The generic encoding set does not appear in the BOM header, which appears in the Unicode encoding set.

Software such as Windows-brought Notepad, when saving a UTF-8 encoded file, inserts three invisible characters (0xEF 0xBB 0xBF, or BOM) where the file begins. It is a string of hidden characters that allows editors such as Notepad to identify whether the file is encoded in UTF-8. For general files, this does not cause any trouble. But for PHP, BOM is a big hassle.

PHP does not ignore the BOM, so when you read, include, or reference these files, the BOM is used as part of the text at the beginning of the file. Depending on the characteristics of the embedded language, this string of characters will be executed directly (shown). This results in even if the top padding of the page is set to 0, can't keep the entire page close to the top of the browserBecause there are 3 characters at the beginning of the HTML! Reference: HTTP://BLOG.SINA.COM.CN/S/BLOG_6EC912D80101BTCL.HTML2. Workaround

A. EditPlus to the BOM head method

After the editor is resized to UTF8 encoded format, the saved file will be preceded by a string of hidden characters (also known as BOMs), used by the editor to identify whether the file is encoded in UTF8.
RunEditPlusClickToolsChooseparameter SettingsSelectedfile, the default encoding is Utf-8. or save file as, encoding selects Utf-8.

B. Notepad removal of BOM head approach

After opening the file, select Utf-8 no BOM format encoding in the encoding, OK.

Do not accumulate Kuibu not even thousands of miles, refueling

A blank address appears at the top of the page in the Chrome browser

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.