yii2: Redirect problems in Internet Explorer 11 (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: pjax-response-error

The response headers: pjax-response-headers

One comment on StackOverflow suggested using the status code 200, and after testing, this does appear to work. I know the default redirect status code is 302, but this just doesn’t work.

Update

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.

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 22 (19 by maintainers)

Commits related to this issue

Most upvoted comments

The problem is still persists for regular ajax redirects in IE & Edge, because HTTP request does not contain header “X-Ie-Redirect-Compatibility” so redirect does not work properly.

How to fix this issue? I am getting the same error trying to post json data to controller/action from Javascript using $.ajax. Works well in other browsers… having issue in IE11.

$.ajax({ type: ‘POST’, url: ‘/site/register-payment’, data: {paymentdata:res}, dataType: ‘json’ });

I agree with @Fr1ar . yii should handle this, issue in yii.js RedirectHandler. we’re having this problem still.