Display that redirects were followed properly #7
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
When clicking a link which triggers a redirect (302 or whatever), PJAX disregards it and pushed the state with the link's URL.
I think it should push, in the state, the URL as sent in the response's header "Location". Also, probably worth looking at that header to check if the URL is external and if it is, then don't try to do PJAX on it.
Oh yeah. Will also add this to the incoming tests. Thanks for the report.
I've planned to work on that this week.
I've tried tackling this on my own and it's not quite possible.
There's no way to figure out if there was a redirect. The only way I found was to add a header in the response, from my server, stating the "final url".
Hum... Do you check others implementations of pjax ? Like jquery-pjax or turbolinks ?
This feature would be useful to me as well.
Looks like jquery-pjax looks for a special 'X-PJAX-URL' response header and then falls back to the request url. Turbolinks looks for a 'X-XHR-Redirected-To' response header which is set by the gem on the server side (Rails).
Would it be possible to make use of the
response.responseUrlproperty where/when it's available?Not a bad idea. We should make this key customisable.
PR welcome :)
I believe this feature is extremely crucial, but if it requires changes to the server breaks the "it just works" feature of this library.
While we're doing this, @MoOx would you like pjax to send a X-PJAX header to the server so that the server can detect a pjax request?
Why not.
The X-PJAX header has been added by #80.
However, there is currently no implementation for checking a X-PJAX-URL header.
It looks like XMLHttpRequest.responseURL reflects the final URL after redirects. I see it's already being used in the tests.
Although it isn't supported by all browsers (most notably, IE), we should definitely check if it's available and use it if it is.