17 August 2012

How to get a .gif file to replay

Earlier this week two readers solved for me a problem that has bugged me for years.  When I'm surfing the web looking for material for the blog, I go to sets of bookmark folders that each have 12 links, and open all twelve at once ("tabbed browsing").

It's works fine for browsing, but sometimes when I get to one of the tabs I discover that a .gif on the page has already completed playing, and all I can see is the final image.  Refreshing the page or reloading the url never restarted the little video.

When I posted about the evolution of Olympics gymnastics, reader Danack offered this link in his comment:
http://www.basereality.com/proxy/1134/Olympic-vaults-compared.gif
I watched the gif, and it was interesting, but it wouldn't replay for me.   So I asked how to do it, and he replied:
There's probably a better way, but on most webservers you can append any query to force an image to be reloaded, by adding a '?' and then 'something=something'

e.g. http://www.basereality.com/proxy/1134/Olympic-vaults-compared.gif?lol=wut

If you're using firefox, it may be a setting was altered:
http://kb.mozillazine.org/Animated_images
That worked (it also sometimes works just by adding a "?").  And then later in the day Matthias directed me to a Lifehacker article, which suggested that using Shift+refresh would solve the problem.
Caching is almost always a good thing, but occasionally something can go wrong in the cache...  The web site won't work the way it's supposed to. The same sort of problems also occur with stylesheets (ever seen a web site that looks like all the nice sparkle went away and all you can see is unstyled text?) and images.

Sure, you could clear your entire browser cache (in Firefox: Tools -> Clear Recent History), restart your browser, or go nuts and restart your computer, but most of the time that's overkill. Any of those methods could be worth trying eventually, but before you try anything more drastic or time-consuming just hold your Shift key and click the Refresh button in your browser (or press Ctrl+Shift+R [Win]/Ctrl+F5 [Win]/Cmd+Shift+R [Mac]; the keyboard shortcut doesn't work on Safari). While a normal page refresh (whether you click the refresh button or use the F5/Ctrl+R/Cmd+R shortcuts) still uses those cached files rather than re-downloading them, the Shift+Refresh clears the cache for the files in that page so that you're sure to be running the latest and greatest version of what that web site's serving.
You learn something every day.   A hat tip to both readers.

3 comments:

  1. I am really humbled by the way you give credit to your users and make sure to share.

    Happy to have helped, and to be part of the family.

    ReplyDelete
    Replies
    1. Welcome on board as a contributor. A surprising number of the posts on this blog get amended, supplemented, proofread, and in various ways improved by readers. The process also makes the blogging more pleasant (and informative) for me. :.)

      Delete
  2. To make the query solution just a tad simpler, you don't even need to write anything coherent after the question mark (i.e. x=y). I usually just type some garbage, (i.e. …?hsdfa). All that needs to happen is the browser needs to think that there is some unique information after the ? that it doesn't have cached.

    ReplyDelete