This is a migrated thread and some comments may be shown as answers.

Getting Text from e.XMLHttpRequest.responseText doesn't work on IE

3 Answers 155 Views
Upload
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Michael
Top achievements
Rank 2
Michael asked on 22 Aug 2011, 04:47 PM

I'm trying to display a custom error from the server in an OnError handler like so

function Grid_onError(e) {
    if (e.XMLHttpRequest.status == "500") {
        notify(e.XMLHttpRequest.responseText);
        e.preventDefault();
    }
}

It renders fine in most browsers except IE doesn't like me doing this (apparently it's not using jQuery's Xhr that detects and handle's IE's security model). Is there a way to get the original jQuery XHR object instead of the native XHR?

3 Answers, 1 is accepted

Sort by
0
T. Tsonev
Telerik team
answered on 22 Aug 2011, 04:58 PM
Hi Michael,

The upload does not use a XHR, but an IFRAME for IE. The XMLHttpRequest field is provided only for consistency with its fields populated by the upload.

I hope this helps.

Kind regards,
Tsvetomir Tsonev
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
Michael
Top achievements
Rank 2
answered on 22 Aug 2011, 07:47 PM
Trying to access the value as was shown in a previous thread results in an IE error (searching on the text of the error led me to believe that it was related to XHR).

When trying to get the response back in IE I the following text is returned:
Error trying to get server response: Error: Access is denied.

In all other browsers, I get the expected error text that I am sending back from the server. Looking at the traffic in fiddler, my server is returning the correct response, but I get the Access is Denied error.

As I was typing this, one of my developers discovered that we were setting a 500 status when there was an error. Removing the 500 status and just setting the error text appears to have resolved the issue. I guess whatever is happening in your code, IE isn't a fan of it happening under a 500 status.
0
T. Tsonev
Telerik team
answered on 23 Aug 2011, 08:25 AM
Hi Michael,

I can confirm this IE behavior - it will deny access to the IFRAME content (the error message) when the response code is not 200 OK.

I believe IE is treating its local error pages as cross-domain resources and denies access based on that.

Best wishes,
Tsvetomir Tsonev
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Tags
Upload
Asked by
Michael
Top achievements
Rank 2
Answers by
T. Tsonev
Telerik team
Michael
Top achievements
Rank 2
Share this question
or