on it which is updated via RJS. If I
add/delete from the
, advance to the next page, then use the Back
button to return, the updates do not appear unless I Refresh the page.
This is in development mode where caching is disabled (I checked
development.rb to be sure). I’ve tried expiring the page and that
doesn’t help. Anybody got any idea what’s going on with this?
I see this issue too, but it doesn’t happen in Safari, just Firefox (I
haven’t tested it in IE). It might have something to do with the
browser not using the newly-updated DOM instead of what it got from
the original request.
Does anyone know how to force the browser to show the updated version?
Do we need to force a refresh when the back button is used?
I was just playing with Backpack and its todo list items to see how
this is handled there, and it seems to have this “bug” too. It seems
to consistently not see the new items in the todo list after a back
button in Firefox. Oddly, where Safari consistently remembers the new
items on my app, Backpack seems less consistent, sometimes it does and
sometimes not. In any case, it does seem to be an issue, but a
browser-dependent one.
Maybe by adding directives to not cache the page, you could guarantee
a refresh (at the expense of losing the snappier UI)?
In any case, it does seem to be an issue, but a
browser-dependent one.
I agree that the results differ by browser, but…
Maybe by adding directives to not cache the page, you could guarantee
a refresh (at the expense of losing the snappier UI)?
Any ideas what directives I might use? In development mode caching is
already turned off in config/development.rb.
According to the W3C’s RFC 2616, if caching is turned off, the client
and
any proxies in between must NOT use the local copy without revalidating
the
content with the server.
WRT it being a browser issue, Firefox does, in fact, check with the
server
to validate it’s copy. I can tell because it does get a new copy of
the
rest of the page. I’m inclined, at this point, to think that RJS is not
paying attention to the page’s Cache-Control setting and is marking the
fragments it renders as ‘cachable’ when the page it’s updating is maked
‘not
cachable’. If that’s the case, that’s a bug. It could be a serious
one,
too, because that could mean that RJS isn’t safe to use in apps that
serve
secure content.
I was able to get Firefox to reload the entire page, even the parts
rendered
via RJS, by adding ‘no-store’ to the Cache-Control header. I did this
by
adding a protected method to application.rb and calling it in an
after_filter in each of the controllers that use RJS templates. Code
below
for folks in the future.
I see this issue too, but it doesn’t happen in Safari, just Firefox (I
haven’t tested it in IE). It might have something to do with the
browser not using the newly-updated DOM instead of what it got from
the original request.
fwiw, the technical reason behind this is that Firefox doesn’t make
another request when you hit back, but simply renders the HTML that it
first downloaded. It’s similar to performing a lot of DOM-modifying
actions and then viewing the source - you’ll only see the original
HTML.
You could try using no-cache or expires metatags. I don’t know
offhand how Firefox behaves though.
Pat
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.