CSS background image being downloaded more than once

Posted by Nick Clarke on Stack Overflow See other posts from Stack Overflow or by Nick Clarke
Published on 2009-10-30T12:36:06Z Indexed on 2010/03/16 7:06 UTC
Read the original article Hit count: 459

Filed under:
|

I noticed in my current project that Firefox (3.5.4) downloads the background image (set in CSS) for my divs more than once.

I've checked with both firebug and wireshark and it really does appear that it does not wait for the first request to finish and then simply use the cached version.

Wireshark also confirms that Chrome and IE8 do as expected and only request the image once.

Any ideas what might be causing this?

Here is a small test:

Sample Page

or

<html>
<head>
	<style>
		#one
		{
			height: 300px;
			width:100%;
			background: #FFF url('random.jpg');
		}
		#two
		{
			height: 300px;
			width:100%;
			background: #FFF url('random.jpg');
		}
		#three
		{
			height: 300px;
			width:100%;
			background: #FFF url('random.jpg');
		}
	</style>
</head>
<body>
	<div id="one"></div>
	<div id="two"></div>
	<div id="three"></div>
</body>

EDIT

I opened up a bug request as I could not find one already on bugzilla, but it turns out to be an old bug with 3.5.

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

© Stack Overflow or respective owner

Related posts about css

Related posts about firefox