Grow your CSS skills. Land your dream job.

Last updated on:

Prevent Background Image Flickering in IE

try {
 document.execCommand("BackgroundImageCache", false, true);
} catch(err) {}

Comments

  1. paul
    Permalink to comment#

    i really like this blog, keep making!!

  2. Leonard Michael

    Silly question perhaps, but how do you use/implement this?

    Example?

    • Permalink to comment#

      I believe you just put it in your head, like this:

      try {
      document.execCommand(“BackgroundImageCache”, false, true);
      } catch(err) {}

    • Permalink to comment#

      [script type="javascript"]
      try {
      document.execCommand(“BackgroundImageCache”, false, true);
      } catch(err) {}
      [/script]

      Sub in the real brackets in the code

  3. saverio

    graet

  4. sujji
    Permalink to comment#

    hi,
    i used the above code . but still i am facing image flickering. i have to place the names of the images in the place of BackgroundImageCache. please help me

Leave a Comment

Posting Code

  • Use Markdown, and it will escape the code for you, like `<div class="cool">`.
  • Use triple-backticks for blocks of code.
    ``` 
    <div>
      <h1>multi-line block of code</h1>
      <span>be cool yo.</span>
    </div>
    ```
  • Otherwise, escape your code, like <code>&lt;div class="cool"&gt;</code>. Markdown is just easier though.

Current ye@r *

*May or may not contain any actual "CSS" or "Tricks".