Handling Page updated Status

hi all,
This is my first post in this forum. Found the site pretty
useful.
I have a link in a page, clicking on it takes to another page and
immediately changes the status of a variable. Now if i press the browser
back button the changes in the variable is not reflecting. The reason
being it takes the information form the browser cache. I expect the
latest updated status of the variable. Need help.

Syed Arif wrote:

hi all,
This is my first post in this forum. Found the site pretty
useful.
I have a link in a page, clicking on it takes to another page and
immediately changes the status of a variable. Now if i press the browser
back button the changes in the variable is not reflecting. The reason
being it takes the information form the browser cache. I expect the
latest updated status of the variable. Need help.

By default rails tells the browser not to cache your apps pages.
However, the back button usually ignores this. Firefox even keeps your
form fields and changes made by javascript in the back-button cache and
it’s touted as a feature.

I’m not sure there is a way around this. Back button’s can be quite
problematic for web apps.

Syed Arif wrote:

   I have a link in a page, clicking on it takes to another page and

immediately changes the status of a variable. Now if i press the browser
back button the changes in the variable is not reflecting. The reason
being it takes the information form the browser cache. I expect the
latest updated status of the variable. Need help.

Try adding “expires_now” to the action that generates the page
containing the variable:

http://api.rubyonrails.com/classes/ActionController/Base.html#M000273


We develop, watch us RoR, in numbers too big to ignore.

Mark Reginald J. wrote:

Syed Arif wrote:

   I have a link in a page, clicking on it takes to another page and

immediately changes the status of a variable. Now if i press the browser
back button the changes in the variable is not reflecting. The reason
being it takes the information form the browser cache. I expect the
latest updated status of the variable. Need help.

Try adding “expires_now” to the action that generates the page
containing the variable:

http://api.rubyonrails.com/classes/ActionController/Base.html#M000273


We develop, watch us RoR, in numbers too big to ignore.

expires_now did not work. i need to clear the cache of the browser, if
action_expires is used in the response @headers={“cookie”=>[],
“Cache-Control”=>“no-cache”} is set but still it takes the cache
information…
Have no clue what to do… or i am thinking of removing the back button
from my application.

Syed Arif wrote:

Mark Reginald J. wrote:

Syed Arif wrote:

   I have a link in a page, clicking on it takes to another page and

immediately changes the status of a variable. Now if i press the browser
back button the changes in the variable is not reflecting. The reason
being it takes the information form the browser cache. I expect the
latest updated status of the variable. Need help.

Try adding “expires_now” to the action that generates the page
containing the variable:

http://api.rubyonrails.com/classes/ActionController/Base.html#M000273


We develop, watch us RoR, in numbers too big to ignore.

expires_now did not work. i need to clear the cache of the browser, if
action_expires is used in the response @headers={“cookie”=>[],
“Cache-Control”=>“no-cache”} is set but still it takes the cache
information…
Have no clue what to do… or i am thinking of removing the back button
from my application.

hi, i got the solution, it works in firefox, since iam using apache
server
i can set my headers not to cache the pages “no-store”. but in ie it
does not work… any idea…???

syed arif wrote:

Syed Arif wrote:

Mark Reginald J. wrote:

Syed Arif wrote:

   I have a link in a page, clicking on it takes to another page and

immediately changes the status of a variable. Now if i press the browser
back button the changes in the variable is not reflecting. The reason
being it takes the information form the browser cache. I expect the
latest updated status of the variable. Need help.

Try adding “expires_now” to the action that generates the page
containing the variable:

http://api.rubyonrails.com/classes/ActionController/Base.html#M000273


We develop, watch us RoR, in numbers too big to ignore.

expires_now did not work. i need to clear the cache of the browser, if
action_expires is used in the response @headers={“cookie”=>[],
“Cache-Control”=>“no-cache”} is set but still it takes the cache
information…
Have no clue what to do… or i am thinking of removing the back button
from my application.

hi, i got the solution, it works in firefox, since iam using apache
server
i can set my headers not to cache the pages “no-store”. but in ie it
does not work… any idea…???

hi all,
Finally found the way to handle back button problem in browsers if
your web server in apache 1.3 or greater.
In IE , iam using apache2.2.3 and it sends http1.1 response. Rails by
default sets the the Cache-Control to “no-cache” so it should always
fetch the fresh page.(make sure that u bypass proxy, if used.)

In FF, u need to set “no-store” in Cache-Control so u will get the fresh
page
(do not worry about proxy here)

  1. The best way is to set these http response headers in .htaccess files
    under public folder in your rails application.
    Header set Cache-Control “no-store, no-cache”.

  2. The other way is to set in every response you send from the code
    using the interfaces available to set the http headers in rails.

I will suggest the first one.

HTTP 1.1 is intelligent that HTTP1.0 in caching mechanism.

Thanks.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs