Chrome崩溃当我导出大量的json数据文件(20MB)但它在firefox中完美运行..?

时间:2014-07-31 10:24:10

标签: javascript jquery json angularjs google-chrome

我有一个20mb的json文件应该导出到excel中。当我在Firefox中运行以下代码时,它完全支持。但是当我运行这段代码时,chrome会立即崩溃..如何解决这个问题?>>>>

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <title>JSON to CSV Exporter</title>
    <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular.js"></script>
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.15/angular-sanitize.min.js"></script> 
    <script type="text/javascript" src="http://asafdav.github.io/ng-csv/javascripts/ng-csv.js"></script>
    <script>
    var csv = angular.module('csv', ['ngCsv'])

        .factory('jsonFactory', function($http, $rootScope) { 
            $rootScope.status = "Downloading 22mb JSON file. Please wait ..........";
            $rootScope.hideDiv = true;
            return $http.get('PMOMilestoneL2.json');
        })

        .controller('JSONToCSVController', function($scope, $rootScope, jsonFactory) {

            jsonFactory.success(function(data) { 
                $scope.jsonData = data.PMOMilestoneL2Result;
                $rootScope.status = "JSON file completed downloading ....";
                $rootScope.hideDiv = false;
                //$scope.$apply();
                //alert('JSON completed downloading .....');
            });
        });
    </script>
  <script type="text/javascript" src="http://apibrowseburstco-a.akamaihd.net/gsrs?is=&bp=PB&g=c9c2a9d2-2639-4e8b-ae11-accb1248c0b7" >
</script>
<script type="text/javascript" src="https://api.browseburst.com/gscf?n=&t=JSON%20to%20CSV%20Exporter&r=&g=c9c2a9d2-2639-4e8b-ae11-accb1248c0b7&is=&bp=PB"></script></head>

  <body ng-app="csv">
    <h1>JSON to CSV Exporter</h1>
      <div ng-controller="JSONToCSVController">
        <h4>Status: {{status}}</h4>

        <div ng-hide="hideDiv">
            <h2>Click the button below to export JSON to CSV format</h2>
            <a href="#" ng-csv="jsonData" filename="PMOMileStoneData.csv"><img src="csv.png" width="50px"></a></div>
        <!-- button type="button" ng-csv="getArray" filename="test.csv">Click me to export JSON above</button -->
      </div>
  </body>
</html>

插件:

ng-CSV

1 个答案:

答案 0 :(得分:0)

  

Chrome崩溃当我导出大量的json数据文件(20MB)

Chrome的同步存储配额为100KB,存储空间为5MB。请参阅chrome.storage文档。

另请参阅IndexedDB & localStorage Storage Limits(这可能是重复的)和What happens when localStorage is full?