Animated gifs stop animating in IE

An annoying bug/ feature of Internet Explorer is that animated gifs stop animating the moment you click a link to navigate to another page. Other things can stop them animating too: I recently found that a flash-based file uploader that we use triggers this bug when it finishes the upload.

Fortunately it's not to hard to work around. If you reassign the value of the src attribute of the <img> tag, the animation starts again.

jQuery makes it easy to reassign all such tags in one fell swoop:

<span style="color: #008000">//codesnippet:7660712A-6D8A-4820-A99F-751F44A57AD2</span>
<span style="color: #0000ff">function</span> fixAnimatedGifsDamnYouInternetExplorer()
{
    $(&quot;<span style="color: #8b0000">img</span>&quot;).each(<span style="color: #0000ff">function</span>()
    {
        <span style="color: #0000ff">this</span>.src = <span style="color: #0000ff">this</span>.src;
    });
}

In my case, I called this function when my upload completed, but you could easily attach it to the click event of every link on your page.