Ruby on Rails Wednesday, September 29, 2010

On Sep 28, 2010, at 9:16 PM, jdc wrote:

> I have a wizard type flow where on each screen clicking the "continue"
> button posts data to the server, then I use redirect_to to show the
> main wizard page (which dynamically shows partials based on the
> current state). The oddity I'm seeing - and maybe it's just an HTTP
> thing - is that when these redirects happen, there is NO entry in the
> browser history - not even for the page that was redirected to. So,
> if this happens:
>
> GET /wizard (on "page 1" here)
> POST /wizard (form filled in on "page 1" is processed here,
> model's page parameter changed to "2", then I do a redirect_to
> wizard_url)
> GET /wizard (on "page 2" here because the model had it's page
> number changed)
>
> What I see in history is the initial entry for wizard and that's it.
> So if a user is on page 2 (or 3 or 4 or whatever) and hits their back
> button, they go back to whatever page was displayed before they first
> started the wizard.
>
> Is there a special HTTP code I can set using the :status parameter to
> force it to put ALL of the GET requests in the history (even the ones
> initiated by redirect)?

There might be, but I haven't heard of it. What your describing actually makes sense. A redirect implies the page is now elsewhere. So why save it in the history? That is...

GET /some-page (in history)
GET /some-old-url (results in redirect to /some-new-url)
GET /some-new-url (in history)

Why, normally would you want to see that second request in your browser history?

I don't know how you have your app setup, but instead of redirecting, what about sending back an almost empty page containing just enough javascript or meta-refresh to take you to the next page.

-philip

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment