Closed Bug 370675 Opened 17 years ago Closed 17 years ago

Empty url in css background-image cause current page to be loaded twice

Categories

(Firefox :: General, defect)

defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 225554

People

(Reporter: deubeulyou, Unassigned)

References

()

Details

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.1) Gecko/20061208 Firefox/2.0.0.1
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.1) Gecko/20061208 Firefox/2.0.0.1

If an element uses a style like:
   background-image: url('');
the html page will be loaded twice.

It looks as if Firefox tried to use the URL of the current page to get the background image.

Reproducible: Always

Steps to Reproduce:
1. Visit http://0x42.popoz.org/firefox-css-empty-url.html with Firebug enabled
2. Verify that html file is indeed requested twice

Actual Results:  
The html file is requested two times by firefox, generating traffic and server-side load.

Expected Results:  
Firefox should not load anything; the background-image declaration should be ignored.

The problem is also documented here:

http://cwiki.apache.org/WICKET/best-practices-and-gotchas.html
See http://www.w3.org/TR/CSS21/syndata.html#value-def-uri - url('') is a relative URL, which resolves to the base URL, in this case the same as your HTML URL, so we request it again with headers saying "we want an image this time" to enable content negotiation, just like we do with <img src="">.
Status: UNCONFIRMED → RESOLVED
Closed: 17 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.