XmlHttpRequest在IE中比在Chrome中需要更多时间吗?

编程入门 行业动态 更新时间:2024-10-23 15:33:32
本文介绍了XmlHttpRequest在IE中比在Chrome中需要更多时间吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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

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

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

var kendoDataSource = new kendo.data.DataSource({ / /带本地数据的假运输 transport:{ read:function(options){ //设置结果 options.success(lookupValues); } $ b (b,b){$ b}, schema:{ parse:function(response){ //按名称排序不区分大小写 response.sort $ b return(a.Name.toLowerCase()> b.Name.toLowerCase())? 1:(a.Name.toLowerCase()和数据请求

$ http({method:'GET',url:'REST / SystemDataSet /'+ id +'/ Values'})。success(function(response){ //存储数据 lookupValues =响应; kendoDataSource.read(); //在这里做一些逻辑})。error(function(error){ //逻辑});

我这样做是因为有一些额外的逻辑来操纵数据。

在Chrome中的这个请求需要32毫秒,而在IE中需要将近9秒。 检索的数据是相同的(你可以看到响应的大小),这是一个JSon对象的数组(非常简单)。

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

有什么可能导致这种行为的想法?据我所知,如果有缓存或其他东西,它应该是相同的每个浏览器,所以这应该发生在两个不仅在IE浏览器 - 后端是不知道的浏览器。

以下是我从另一个请求中检查第一个IE请求中的时间分配的额外信息

正如您所看到的,最大的部分是请求,这是发送请求并接收服务器的第一个响应所需的时间。

感谢您提前申请

解决方案

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

docs.telerik/ kendo-ui / web / upload / troubleshooting

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

解决方案

对于IE10,请参阅 KB2980019

a>

截至2014年11月6日,没有针对IE 11的官方修复程序。请参阅bug ID 819941

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)

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

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

解决方案

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

docs.telerik/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

更多推荐

XmlHttpRequest在IE中比在Chrome中需要更多时间吗?

本文发布于:2023-11-26 20:09:12,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1635013.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:时间   更多   XmlHttpRequest   Chrome

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!