Skip to content
This repository has been archived by the owner on Jul 28, 2018. It is now read-only.

302 redirects do not seem to work #22

Closed
fklingler opened this issue Sep 27, 2012 · 5 comments · Fixed by #48
Closed

302 redirects do not seem to work #22

fklingler opened this issue Sep 27, 2012 · 5 comments · Fixed by #48

Comments

@fklingler
Copy link

It seems that when you click on a link where a 302 redirect is made, the content is changed but the url in the browser reflects the url before the redirect.

Example :

  • When I click on http://example.com/carts/42/line_items?item_id=123
  • I should be redirect to http://example.com/my_cart
  • The content is the good one, but the url is http://example.com/carts/42/line_items?item_id=123 in the navbar
@davydotcom
Copy link
Contributor

XHR Has no way to detect if a request is a redirect. The redirect is captured by the browser before hitting the response. Checked to see if it could be caught onreadystatechange but no dice. This may be a limitation of turbolinks

@dhh
Copy link
Contributor

dhh commented Sep 27, 2012

Yes, this is a limitation of turbolinks. You can't fix this problem without cooperation from the server side and much added complexity. Not in the cards at the moment.

@dhh
Copy link
Contributor

dhh commented Sep 28, 2012

We might do a helper ala redirect_via_turbolinks_to or something like that. Would just send Turbolinks.visit(url).

@subimage
Copy link

So @dhh is the idea that redirect_via_turbolinks_to is supposed to be used with a format.js {} block? I see that it outputs JS. How are you guys handling that @ 37s for Basecamp?

@dhh
Copy link
Contributor

dhh commented Oct 21, 2013

We need something better that. It doesn't provide any good fallback mechanism at the moment. We need to detect Turbolinks vs not. format.js won't work, because Turbolinks actually requests format.html.

On Oct 15, 2013, at 4:27 PM, Seth notifications@github.com wrote:

So @dhh is the idea that redirect_via_turbolinks_to is supposed to be used with a format.js {} block? I see that it outputs JS. How are you guys handling that @ 37s for Basecamp?


Reply to this email directly or view it on GitHub.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
4 participants