473,385 Members | 1,337 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

IE6 Requests CSS Background Image Every Time!

Hi,
I found a bug in IE6, though it is known already. If I have a CSS
background property set to some image, such as
background:url(myimg.gif);, and I apply this property to some html
element, say DIV, and refresh DIV every 10 seconds, background image
is reguested every 10 seconds for IE6, too.

The fix which I found did not fix the problem:
try {
document.execCommand("BackgroundImageCache", false, true);
} catch(err) {}

Relative info:
http://www.mister-pixel.com/#Content...is_that_simple
http://dean.edwards.name/my/flicker.html
http://www.fivesevensix.com/studies/ie6flicker/

What's the known workaround?

May 7 '07 #1
4 4210
On May 7, 8:59 am, vunet...@gmail.com wrote:
The fix which I found did not fix the problem:
try {
document.execCommand("BackgroundImageCache", false, true);

} catch(err) {}
What's the known workaround?
It seems to work for me. I have this in many of my site js files:

// Turn on background image caching in IE
// --------------------------------------
/*@cc_on
if (document && document.execCommand) {
try { document.execCommand("BackgroundImageCache",false, true); }
catch (e) { }
}
@*/

Matt Kruse
http://www.JavascriptToolbox.com

May 7 '07 #2
On May 7, 10:08 am, Matt Kruse <m...@mattkruse.comwrote:
On May 7, 8:59 am, vunet...@gmail.com wrote:
The fix which I found did not fix the problem:
try {
document.execCommand("BackgroundImageCache", false, true);
} catch(err) {}
What's the known workaround?

It seems to work for me. I have this in many of my site js files:

// Turn on background image caching in IE
// --------------------------------------
/*@cc_on
if (document && document.execCommand) {
try { document.execCommand("BackgroundImageCache",false, true); }
catch (e) { }}

@*/

Matt Krusehttp://www.JavascriptToolbox.com
Hmmm... Maybe it works, but my access.log file in Tomcat shows these
images are requested every time. How do you know if it works for you?
Thanks.

May 7 '07 #3
On May 7, 10:38 am, vunet...@gmail.com wrote:
On May 7, 10:08 am, Matt Kruse <m...@mattkruse.comwrote:
On May 7, 8:59 am, vunet...@gmail.com wrote:
The fix which I found did not fix the problem:
try {
document.execCommand("BackgroundImageCache", false, true);
} catch(err) {}
What's the known workaround?
It seems to work for me. I have this in many of my site js files:
// Turn on background image caching in IE
// --------------------------------------
/*@cc_on
if (document && document.execCommand) {
try { document.execCommand("BackgroundImageCache",false, true); }
catch (e) { }}
@*/
Matt Krusehttp://www.JavascriptToolbox.com

Hmmm... Maybe it works, but my access.log file in Tomcat shows these
images are requested every time. How do you know if it works for you?
Thanks.
Additional word. It solved the problem (with JS or server
configuration) by sending HTTP 304 (not modified) instead of earlier
200 (request ok). But I do not to see those requests at all. How
possible is it?

May 7 '07 #4
The most effective way to solve this problem (and improve the
performance of your application at the same time) is to apply caching
header directives. All images should have a caching header indicating
when the image should expire from the cache. With this header IE will
cache the image and not continually make requests over and over.
Tomcat does not have the ability to do this out of the box. I
actually just finished a release of a little Tomcat/J2EE app server
plugin (a filter) that makes this very easy to do. You can take a look
and download Resource Accelerate at http://www.xucia.com/#Resource%20Accelerate.
This should apply caching headers for you and fix your multiple
request problem.
Kris
www.xucia.com

On May 7, 7:47 am, vunet...@gmail.com wrote:
On May 7, 10:38 am, vunet...@gmail.com wrote:


On May 7, 10:08 am, Matt Kruse <m...@mattkruse.comwrote:
On May 7, 8:59 am, vunet...@gmail.com wrote:
The fix which I found did not fix the problem:
try {
document.execCommand("BackgroundImageCache", false, true);
} catch(err) {}
What's the known workaround?
It seems to work for me. I have this in many of my site js files:
// Turn on background image caching in IE
// --------------------------------------
/*@cc_on
if (document && document.execCommand) {
try { document.execCommand("BackgroundImageCache",false, true); }
catch (e) { }}
@*/
Matt Krusehttp://www.JavascriptToolbox.com
Hmmm... Maybe it works, but my access.log file in Tomcat shows these
images are requested every time. How do you know if it works for you?
Thanks.

Additional word. It solved the problem (with JS or server
configuration) by sending HTTP 304 (not modified) instead of earlier
200 (request ok). But I do not to see those requests at all. How
possible is it?- Hide quoted text -

- Show quoted text -

May 8 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Markus Mohr | last post by:
Hi, everyone, I have a special problem: For every monitor resolution in 200 pixel steps from 800 to 1600 pixels I have an image to be shown as centered background-image. Those images all...
23
by: Erik Schulp | last post by:
Hi all, I am using a background image via a stylsheet. I've used this code: background-image:url("/images/tile.gif"); (which I think is correct) The image doesn't show up however, the path,...
3
by: Bond | last post by:
how do I know when the browser is making a request to the server? I am not having an onclick event for EVERY hyperlink, submit, etc. There must be some javascript function that I can overwrite...
13
by: Giggle Girl | last post by:
Hi there, I need to use a background image in a TR that does NOT restart everytime it hits a TD. Can it be done? Specifically, if you set a background image for an entier table, now mater how...
4
by: Steve Dambrowski | last post by:
How do I make my background image fit the screen so no one has to scroll, and at the same time it's not tiled looking?? I have one that is 800x600 and one that is 1084x768. The small one...
6
by: Rob | last post by:
Hello, I'm sure this has come up before. I have need for a collection of all elements/objects in an HTML document that have any kind of an attribute (HTML or CSS) that is making use of a URL to...
4
by: GArlington | last post by:
I am trying to implement an image map (in this particular case a country map) with few <area ...>s on it. The challenge is to add background image (dot) to each <areaso it will display over the...
7
by: =?Utf-8?B?Vkg=?= | last post by:
Hi, all. Need help with what seems to be either connection, or threading problem in my ASP.NET 2.0 application. The gist of the problem is this: IHttpHandler in my application serves an HTML...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.