Sliced Bread Content Management
research
websites that work!

Monday, November 12, 2007

Remove Background Flicker from divs in IE6

There is an annoying bug with IE6 when you use a background image in a div. The browser constantly tries to load the image from the server creating a flicker and can also trick the web server into thinking you are waging a Denial Of Service Attack.

This can result in the web server denying your IP address.

To prevent this you can use a conditional Javascript which is called in the head of your html document:


<script>



(function(){



/*Use Object Detection to detect IE6*/

var m = document.uniqueID /*IE*/

&& document.compatMode /*>=IE6*/

&& !window.XMLHttpRequest /*<=IE6*/

&& document.execCommand ;



try{

if(!!m){

m("BackgroundImageCache", false, true) /* = IE6 only */

}



}catch(oh){};

})();

</script>

Labels: , ,

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home