XmlHttpRequest 在 IE 中是否比在 Chrome 中花费更多的时间? [英] Can a XmlHttpRequest take more time in IE than in Chrome?

查看:15
本文介绍了XmlHttpRequest 在 IE 中是否比在 Chrome 中花费更多的时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用一个 Web 应用程序(它真的很大),所以应用程序的某些部分我真的不知道它们是如何工作的.

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.

我是一名前端开发人员,我正在使用使用 .NET Web Api 实现的 REST API(据我所知)

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

请求很简单 - 我使用 kendo Datasource 像这样从服务器获取数据

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
                });

以及对数据的请求

$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.

这个请求在 Chrome 中需要大约 32 毫秒,而在 IE 中需要近 9 秒.检索到的数据是一样的(可以看到响应的Size),都是一个JSon对象的数组(很简单)

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)

我不知道后端是否有缓存机制,但这应该没有关系,因为我每次都能像这样重现它(在 Chrome 中很快,在 IE 上真的很慢)

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)

任何可能导致这种行为的想法?据我所知,如果有缓存或其他东西,它应该对每个浏览器都一样,所以这应该发生在两者上,而不仅仅是在 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.

这是我从另一个请求中获得的一些额外信息,用于检查第一个 IE 请求中的时间分布

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

如您所见,最大的部分是请求",即发送请求和接收服务器第一个响应所花费的时间.

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.

提前致谢

推荐答案

问题可能是 Windows 身份验证为您正在调用 ajax 的文件夹打开...同样的原则适用于这里......

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/上传/疑难解答

问题:使用 IE10/11 和 Windows 身份验证时异步上传随机失败如果在 HTTP POST 上收到 401 质询,上传将无限期冻结或超时.

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.

解决方案

对于 IE10,请参阅 KB2980019

For IE10 see KB2980019

截至 2014 年 11 月 6 日,没有针对 IE 11 的官方修复.请参阅错误 ID 819941

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

这篇关于XmlHttpRequest 在 IE 中是否比在 Chrome 中花费更多的时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆