http 11ajax.co,Internet Explorer 11 crashes when Angulars $http.post is used with large/complex json...

本文探讨了在IE11下使用Angular的$http.post发送大型复杂JSON对象时导致浏览器崩溃的问题。作者分享了重现代码、已尝试的解决方法和定位问题的过程,重点关注IE11特定环境下的兼容性挑战。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

I am consistently able to crash IE11 when I post large/complex json object using Angulars $http.post method.

I have setup an angular example which can be run in IE11 to see the behavior which I am experiencing: http://plnkr.co/edit/yYaDy8d00VGV6WcjaUu3?p=preview

This is the code which causes a crash:

$http.post($scope.saveDocumentUrl, { "document": doc, "submit": submit, "trash": trash }).success(function (data) {

if (!data.Success) {

bootbox.alert(data.Message);

} else {

if (trash) {

$scope.periodReviewDocuments.pop(doc);

hideModalWindow(); //we call this in the event that the method was called from the document and not from the list.

}

if(submit){

$scope.periodReviewDocuments.pop(doc);

resetForm();

bootbox.alert("Your document has been submitted");

hideModalWindow();

}

}

$scope.isBusy = false;

}).error(function (data, status) {

$scope.isBusy = false;

bootbox.alert("The server encountered an error and could not save your document. If this problem persists please contact the administrators");

});

This is the jquery working code:

$.ajax({

url: $scope.saveDocumentUrl,

data: JSON.stringify({ "document": doc, "submit": submit, "trash": trash }),

contentType: "application/json; charset=utf-8",

dataType: "json",

type: "POST"

}).done(function (data) {

if (!data.Success) {

bootbox.alert(data.Message);

} else {

if (trash) {

$scope.periodReviewDocuments.pop(doc);

hideModalWindow(); //we call this in the event that the method was called from the document and not from the list.

}

if (submit) {

$scope.periodReviewDocuments.pop(doc);

resetForm();

bootbox.alert("Your document has been submitted");

hideModalWindow();

}

}

$scope.isBusy = false;

}).fail(function (data, status) {

$scope.isBusy = false;

bootbox.alert("The server encountered an error and could not save your document. If this problem persists please contact the administrators");

})

This is what I know so far:

This issue only happens in IE11 - Windows 8.1 / IE 11 (11.0.9600.17498). Update versions 11.0.15 (KB3008923).

The browser crashes after the request is sent.

I have inspected the server side incoming request and the payload has been serialised/deserialised perfectly.

I have replaced the $http.post function with jquery $.ajax and it resolved the issue, but this is not a solution as I am using angular.

I have lost 3 days on this issue

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值