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

I can continually crash IE11 when sending a large / complex json object using the Angulars $ http.post method.

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

This is the code that causes the 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 working jquery 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 problem only occurs in IE11 - Windows 8.1 / IE 11 (11.0.9600.17498). Update Version 11.0.15 (KB3008923).
  • The browser is sent after a crash.
  • I checked the incoming request to the server and the payload was serialized / deserialized perfectly.
  • I replaced the $ http.post function with jquery $ .ajax and it solved the problem, but it is not a solution, since I am using angular.
  • I lost 3 days on this
+5
source share
2 answers

In your version of Internet Explorer calling JSON.stringify with a translation filter, IE crashes for large datasets.

The trick here is to link the object yourself before moving on to $ http.post

http://plnkr.co/edit/PbMxMY?p=preview

  var body = {"document" ..... var jsonData = JSON.stringify(body); $http.post("/test", jsonData).then(function(response) { console.log(response.data); }); $interval(function() { $rootScope.tick = Date.now(); }, 500); }); 
+3
source

This month fixed IE update, possibly https://support.microsoft.com/en-us/kb/3075516

As a side note, you can detect this using ScriptEngineBuildVersion in JavaScript. Make sure that you also use ScriptEngineMajorVersion and ScriptEngineMinorVersion and refer to the file information in the knowledge base article.

0
source

Source: https://habr.com/ru/post/1211775/


All Articles