Closed Q1WP closed 9 years ago
Is the problem still alive?
@SilverFire, yes it is still alive. As a workaround I respond with 200 status for ajax redirects. Only because of IE.
@flowip we have two new options: pushRedirect
and replaceRedirect
. See for description here.
Could you try it, please?
@SilverFire, I don't use Pjax. I just respond with redirect to ajax request. Page redirects in all browsers except IE. I'm testting in IE11. I'm getting the following error in console: XMLHttpRequest: Network Error 0x2f76, Could not complete the operation due to error 00002f76.
.
URL for redirect sent in X-Redirect
header. yii.js
script handles this header, see line 265. var url = xhr.getResponseHeader('X-Redirect');
. In case of IE11 getResponseHeader()
returns null
instead of URL. As I mentioned before I just respond with 200 status at the moment instead of 302.
Oh, I got it. Then it's better to move this issue to the main repo https://github.com/yiisoft/yii2 as it does not affect Pjax plugin itself.
@SilverFire, It was there: https://github.com/yiisoft/yii2/issues/9670. I don't really think it's Pjax bug. I think it's a bug in Yii ajax redirect mechanism. I may be wrong, because I don't use Pjax.
Closing it here then.
I use redirect 308:
public function redirect($url, $statusCode = 302, $checkAjax = true)
{
if (Yii::$app->getRequest()->getIsAjax()) {
if ($statusCode == 302) {
$statusCode = 308;
}
}
return parent::redirect($url, $statusCode, $checkAjax);
}
The controller code adds a header "X-Pjax-Url" that is successfully passed with the response.
The redirect for Pjax is handled through the pjax.js methods just fine in Chrome, Safari, and Firefox, but fails in IE11.
When I use the included IE debugger and view the response headers, the header is there and the url is correct, but IE11 isn't reading it.
The response error:
The response headers:
Any ideas?
I have also asked this on the main Pjax GitHub page, but it hasn't received any responses.