Skip to content
This repository has been archived by the owner. It is now read-only.

fix behavior on redirect, no need for double requests #260

Closed
wants to merge 3 commits into from

Conversation

@lepture
Copy link

@lepture lepture commented Jul 21, 2013

This patch fixes double requests for cross domain redirecting.

@chloerei
Copy link

@chloerei chloerei commented Jul 21, 2013

@lepture Got it, I suggest do like this:

if doc = processResponse()
  # ...
else
  document.location.href = xhr.getResponseHeader('Location') || url

Loading

@lepture
Copy link
Author

@lepture lepture commented Jul 21, 2013

@chloerei I thought it should be before

triggerEvent 'page:receive'

Loading

@chloerei
Copy link

@chloerei chloerei commented Jul 21, 2013

page:receive the page has been fetched from the server, but not yet parsed

I think trigger first is semantically. Although it's a redirect, not a page, but it's fetched from server, and not yet parsed.

Loading

lepture added a commit to lepture/flask-turbolinks that referenced this issue Jul 29, 2013
@reed reed closed this in d496f8b Oct 3, 2014
@reed
Copy link
Collaborator

@reed reed commented Oct 3, 2014

This was a good idea, and I'm sorry it took SO long for me to notice it. I just committed a slightly more cautious implementation, but the functionality is the same.

Loading

@lepture lepture deleted the redirect branch Oct 5, 2014
sebastian-julius pushed a commit to blinkist/turbolinks that referenced this issue Oct 20, 2014
* commit 'c5e4ca2e02547e3d0a0ef51bd879d6a41139444f': (52 commits)
  Fix typo
  Avoid double requests on cross origin redirects - Close turbolinks#260
  v2.4.0
  Don't set request_method cookie for GET requests
  Change Turbolinks.events() array to Turbolinks.EVENTS hash
  Properly ignore empty hash links - Fix turbolinks#407 again
  Handle HTML parsing bug in Safari 7.1 - Fix turbolinks#408
  Check if Content-Type header exists before checking its value - Fix turbolinks#410
  Ignore empty hash links when the current location ends in an empty hash - Fix turbolinks#407
  expose event list via `Turbolinks.events()`
  Move event names into Turbolinks.EVENTS
  Provide target URL to page:before-change event - Close turbolinks#357
  Maintain load order of scripts in the body - Fix turbolinks#389
  Add Prototype compatibility with custom events - Fix turbolinks#384
  Add page:before-unload event - Close turbolinks#401
  Move cloning of link element inside the Link class to preserve ability to inspect surrounding elements
  Clarify page:update description in README - Fix turbolinks#398
  Clone the link so attributes are not altered - Fix turbolinks#399
  Include check for nil-session
  v2.3.0
  ...

Conflicts:
	lib/turbolinks.rb
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants