<p>Is it possible to detect when the user clicks on the browser's back button?</p>
<p>I have an Ajax application and if I can detect when the user clicks on the back button I can display the appropriate data back</p>
<p>Any solution using PHP, JavaScript is preferable. Hell a solution in any language is fine, just need something that I can translate to PHP/JavaScript</p>
<h3>Edit: Cut and paste from below:</h3>
<p>Wow, all excellent answers. I'd like to use Yahoo but I already use Prototype and Scriptaculous libraries and don't want to add more ajax libraries. But it uses <em>iFrames</em> which gives me a good pointer to write my own code.</p>

There are multiple ways of doing it, though some will only work in certain browsers.  One that I know off the top of my head is to embed a tiny near-invisible iframe on the page.  When the user hits the back button the iframe is navigated back which you can detect and then update your page.
Here
is another solution.
You might also want to go view source on something like gmail and see how they do it.
Here's
a library for the sort of thing you're looking for by the way