Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can a XmlHttpRequest take more time in IE than in Chrome?

I'm using a Web App (which is really big) so there are some parts of the application that I really don't know how they work.

I am a front end developer and I'm consuming a REST API implemented with .NET Web Api (as far as I know)

The request is simple - I use kendo Datasource to get the data from the server like this

var kendoDataSource = new kendo.data.DataSource({
                    // fake transport with local data
                    transport: {
                        read: function(options) {
                            // set results
                            options.success(lookupValues);
                        }
                    },
                    schema: {
                        parse: function (response) {
                            // sort case insensitive by name
                            response.sort(function (a, b) {
                                return (a.Name.toLowerCase() > b.Name.toLowerCase()) ? 1 : (a.Name.toLowerCase() < b.Name.toLowerCase()) ? -1 : 0;
                            });
                            return response;
                        }
                    },
                    // set the page size
                    pageSize: 25
                });

and the request for the data

$http({ method: 'GET', url: 'REST/SystemDataSet/' + id + '/Values' }).success(function (response) {
                            // store data
                            lookupValues = response;
                            kendoDataSource.read();
// do some logic here
                        }).error(function(error) {
                            // logic
                        });

I do this in this way because there is some extra logic that manipulates the data.

This request in Chrome takes like 32 ms while it takes almost 9 seconds in IE. The data retrieved is the same (you can see the Size of response), which is an array of JSon objects (Very simple)

enter image description here

I don't know exactly if there is a cache mechanism in the backend, but it shouldn't matter because I'm able to reproduce it like this every time (fast in Chrome, really really slow on IE)

Any ideas of what could be causing this behaviour ? As I understand, if there is a cache or something, it should be the same for every browser, so this should be happening on both and not only on IE - the backend is agnostic of the browser.

Here is some extra information I have from another request to check the distribution of time in the first IE request

enter image description here

As you can see, the biggest part is the "Request", which is the Time taken to send the request and receive the first response from the server.

Thanks in Advance

like image 599
Gonzalo.- Avatar asked Jun 08 '15 20:06

Gonzalo.-


People also ask

What is the purpose of XMLHttpRequest?

XMLHttpRequest (XHR) objects are used to interact with servers. You can retrieve data from a URL without having to do a full page refresh. This enables a Web page to update just part of a page without disrupting what the user is doing. XMLHttpRequest is used heavily in AJAX programming.

Why is it called XMLHttpRequest?

The Outlook team was transferring XML from server to client, so the ActiveX control was named to reflect its primary use at the time. It was included as part of the MSXML parser.

What is an XHR type?

XMLHttpRequest (XHR) is a JavaScript API to create AJAX requests. Its methods provide the ability to send network requests between the browser and a server.

What is AJAX XHR?

XHR is the XMLHttpRequest Object which interacts with the server. Ajax technique in the nutshell leverages the XHR request to send and receive data from the webserver. This object is provided by the browser's javascript environment. It transfers the data between the web browser and server.


1 Answers

The problem is probably Windows Authentication turned on for the folder you are calling the ajax from... Same principle applies here ...

http://docs.telerik.com/kendo-ui/web/upload/troubleshooting

Problem: Async uploads randomly fail when using IE10/11 with Windows Authentication The upload either freezes indefinitely or times out if a 401 challenge is received on the HTTP POST.

Solution

For IE10 see KB2980019

No official fix for IE 11 as of November 6, 2014. See bug ID 819941

like image 177
David OBrien Avatar answered Oct 28 '22 08:10

David OBrien