IMG, script, Link's src/href is empty when the bug

Source: Internet
Author: User

Repeat load

This bug is not new. As early as 2009, Nicholas C. Zakas found the danger of empty src: Empty image src can destroy your site.

Nicholas's findings can be summed up inone sentence: img, script, Link's src/href is empty, it is possible to cause redundant requests.

The cause of today's bug can be supplemented by Nicholas's discovery that, in CSS, the background URL is empty, and may result in redundant requests.

In addition to null values, there is also a problem with a value: #值. like

#值比空值更糟糕. For example, Background:url (#) directly triggers a new request.

Solution:

    1. Wait for the browser to improve itself. Nicholas started in 2009 to promote the browser vendors, now looks like IE repair can also, Firefox will still read from the local cache (repeated reading may lead to JS/CSS again parse + Execute, wasted). For the # value, all browsers are currently not considered comprehensive.

    2. Change your code habits. in the code, the URL/HREF/SRC value is empty or #. This should be the best way to do it right now.

    3. Lessons learned: For open CSS systems, check for background/background-image:url ()/url (#) when the source checks.

Session missing

When the IMG src is empty, it will have a problem with the session dropped

Because the IMG SRC is caused by an empty string, then join if SRC is empty string, just give it away, OK


IMG, script, Link's src/href is empty when the bug

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.