Ajax, the Back button, and Sweepers

I’m working on an app that’s basically forms and that makes fairly heavy
use of Ajax. As a result of the Ajax usage, if the visitor uses the
back button they get the page as it was originally loaded, not as they
left it. I’ve looked at the Sweeper documentation and can not tell for
sure that it’ll do what I want, which is to force an unconditional
reload from the server when the visitor uses the Back button. Anybody
got any experience with Sweepers they’d be willing to share?

Thanks in advance,
Bill

Hi Bill,

I don’t know about Sweepers. Where is the documentation?

I asked similar questions about controlling the back button and
history on comp.lang.javascript. It seems like this is not possible
for security reasons.

http://groups.google.com/group/comp.lang.javascript/browse_thread/thread/690e8d53fc9a593e?hl=en

Peter

Hi Peter,

Peter M. wrote:

I don’t know about Sweepers. Where is the documentation?

http://api.rubyonrails.org in the ActionController::Caching::Sweepers
Class.

I asked similar questions about controlling the back button and
history on comp.lang.javascript. It seems like this is not possible
for security reasons.

My reading is that about all you can do with history is to remove an
entry
to make sure the visitor can’t get there via the Back button. Not at
all
what I want.

It looks like the answer involves, at a minimum, setting the response
headers correctly. According to the W3C RFC 2616 document, the
Cache-Control header is the one that controls caching on the client (and
intermediate proxies). It says… " If the no-cache directive does not
specify a field-name, then a cache MUST NOT use the response to satisfy
a
subsequent request without successful revalidation with the origin
server."

All the error pages I get from Rails have a Response section at the
bottom
with a line that reads ‘Headers: {“cookie” =>[], “Cache-Control”=>
“no-cache”}’. So I’m guessing / hoping that a Sweeper expires the
version
on the server and so, when the client does the ‘revalidation with the
origin
server’, forces a reload. There also seems to be the option of just
expiring fields instead of the entire page. That would be ideal. So
I’m
hoping someone who’s worked with Sweepers will see this and maybe help
me
understand what I need to do.

Anybody?

Best regards,
Bill