Flickr is moving from Flash to Ajax for its photo-management UI and gave a presentation on the changeover at the recent. Reporting on the event, the Ajaxian Blog passed along the following description of one technique Flickr is using:
Getting around the browser cache problem
When change anything on a Flickr page with Ajax, it sets a cookie, and the cookie is set to a timestamp that is inserted into the JS when the page loads. Whenever the page is reloaded (e.g. from cache), and if the cookie value is the same, then a change has happened, and I callback to get the new information.
So in the new Flickr, you can BACK and FORWARD all day, and the original title doesn’t come back to haunt you. Nice hack Eric!
“Nice hack Eric” is an understatement. I’m four years out of this game, and I’m rusty on my browser models and may be missing key details, but I predict that this “nice hack” is going to have quite a career. It makes Ajax play nicely with manual navigation — which makes this one of the final pieces in a very satisfying puzzle. That two sentences suffice to enable anyone to understand it well enough to implement it only adds to the charm.
Those of you who have no idea what I’m talking about shoudln’t worry about it. It’s just something that’ll be making your web-browsing experience better.