[Ruby] Browser Back Problem with Rails
Neil Moomey
neil at motznik.com
Thu Dec 28 18:08:02 PST 2006
I fixed my browser back problem. Thanks Mike for pointing me in the
right direction. First I added the following to each page:
expires_in 1.hours, :public => true, :private => false
Then I concluded that Session data can't handle this very well. The
page would display the same data for the first couple back clicks and
then it would finally display the first page results. So I rewrote my
app using Hidden Fields to pass data instead of session and everything
works fine. I can click Next as many times as I wish and click the
back arrow and it will display the cached pages. Sometimes doing
things the old fashion way is best.
Neil
On 12/11/06, Michael Judge <mjudge at surveycomplete.com> wrote:
> Hey Neil,
>
> I'm pretty sure it's your page's response headers. From p.425 (Agile
> Web Development with Rails -- 2nd Edition), where it's talking about
> the controller environment, it says:
>
> "headers - A hash of HTTP headers that will be used in the response.
> By default, Cache-Control is set to no-cache..."
>
> Aha! So the answer is to set headers["Cache-Control"] to a
> reasonable value in your controller, and Internet Explorer will think
> it's a static page. I don't know what a reasonable value would be,
> but this should be enough info to get you pointed in the right
> direction.
>
> - Mike
>
> On Dec 11, 2006, at 9:24 AM, Neil Moomey wrote:
>
> > I'm not sure if this is a Rails or Webrick problem or what. I
> > noticed the
> > browser back button gives me a "The page cannot be displayed" error
> > on all
> > my pages that post or link to themselves after the second post. I
> > was able
> > to replicate the error with a static html page but when I run this
> > same html
> > page on another web server the problem goes away. I don't recall
> > having
> > this problem with other frameworks. I have not yet set up Apache
> > for Rails
> > but with this problem disappear when I do? I changed the submit
> > button to a
> > link and still have the same error. Oddly enough it works fine in
> > Firefox.
> > Only I.E. has this error message. I tried it on another computer
> > as well.
> > Any ideas?
> >
> > Neil
> > _______________________________________________
> > Ruby at zenspider.com - Seattle.rb non-commercial list
> > http://www.zenspider.com/seattle.rb
> > http://www.zenspider.com/mailman/listinfo/ruby
> >
> >
>
> _______________________________________________
> Ruby at zenspider.com - Seattle.rb non-commercial list
> http://www.zenspider.com/seattle.rb
> http://www.zenspider.com/mailman/listinfo/ruby
>
--
Neil Moomey
Software Developer
Motznik Information Services
8301 Briarwood Street, Suite 100
Anchorage, AK 99518
Ph. 907.344.6254 Fax: 907.344.1759
More information about the Ruby
mailing list