Note-css empty background image will cause the page to be loaded two times

Source: Internet
Author: User
Tags webp

If the page style background picture path is set to ' or ' # ', it will cause the page to be loaded repeatedly two times (chrome.56.0.2924.87 test)

Because: Empty picture Path property value, the URL of the current page is loaded by default as the picture path

Safari and Chrome make a request to the actual page itself.

Internet Explorer makes a request to the directory with which the page is located. --unsure of the rigor of this description, edge.25.10586.0 did not test the problem ~

--Citing articles from 2009, it may be that the browser has been repaired, but the first sentence is described in the same way as the current test results.

Example:

<style= "Background:url ()"></div>

Of these, the header files for two requests were:

1. HTML Request

accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8

2. Image request

accept:image/webp,image/*,*/*;q=0.8

The second request is HTML, but the script in the test page does not execute properly, possibly: (reason for guessing ~)

Because it isn't in a supported image format, so the rest of the response is thrown away.

Other tests: img.src= ' did not cause problems with multiple loads.

Conclusion:

Make sure that the picture path in the page is formatted in the correct format.

Reference:

https://bugzilla.mozilla.org/show_bug.cgi?id=473528

https://github.com/woocommerce/storefront/issues/394

http://icanhascode.com/2008/06/the-mystery-of-the-multiple-requests/

https://lifesinger.wordpress.com/2011/09/22/empty-src-is-dangerous/

https://www.nczonline.net/blog/2009/11/30/empty-image-src-can-destroy-your-site/

https://www.w3.org/TR/css3-background/#the-background-image

Note-css empty background image will cause the page to be loaded two times

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.