下载 Json 作为文件:IE-11 throwing 414 Request-URI Too Large
Download Json as file: IE-11 throwing 414 Request-URI Too Large
我正在尝试将 json 对象下载为 cvs 文件。这个 JSON 对象实际上是由浏览器本身中的 Java 对象组成的。我没有触发任何网络请求。
它在 Chrome 中工作正常,但 IE-11 在网络-> 响应选项卡中抛出以下错误。
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>414 Request-URI Too Large</title>
</head><body>
<h1>Request-URI Too Large</h1>
<p>The requested URL's length exceeds the capacity
limit for this server.<br />
</p>
<hr>
<address>Omniture DC/2.0.0 Server at *.112.2O7.net Port 80</address>
</body></html>
在控制台中,我得到了这个。
The code on this page disabled back and forward caching. For more information, see: http://go.microsoft.com/fwlink/?LinkID=291337
我的javascripts代码如下:
var fileName = "Group Assignment";
var uri = 'data:text/csv;charset=utf-8,' + escape(CSV);
var link = document.getElementById('download-as-csv');
link.href = uri;
link.download = fileName + ".csv";
link.innerHTML = 'Download as CSV';
恐怕你可以通过这种方式做到这一点。 Microsoft Internet Explorer 有一个 limit up to 2048 characters 的 URI。
相反,您最好从不同的页面提供此 CSV 并指向 IE 从那里获取或使用 msSaveOrOpenBlob
示例:
navigator.msSaveOrOpenBlob(new Blob(CSV.split('')), { type: 'text/csv' }), fileName + ".csv");
*仅适用于 IE 10 及更高版本
我正在尝试将 json 对象下载为 cvs 文件。这个 JSON 对象实际上是由浏览器本身中的 Java 对象组成的。我没有触发任何网络请求。
它在 Chrome 中工作正常,但 IE-11 在网络-> 响应选项卡中抛出以下错误。
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>414 Request-URI Too Large</title>
</head><body>
<h1>Request-URI Too Large</h1>
<p>The requested URL's length exceeds the capacity
limit for this server.<br />
</p>
<hr>
<address>Omniture DC/2.0.0 Server at *.112.2O7.net Port 80</address>
</body></html>
在控制台中,我得到了这个。
The code on this page disabled back and forward caching. For more information, see: http://go.microsoft.com/fwlink/?LinkID=291337
我的javascripts代码如下:
var fileName = "Group Assignment";
var uri = 'data:text/csv;charset=utf-8,' + escape(CSV);
var link = document.getElementById('download-as-csv');
link.href = uri;
link.download = fileName + ".csv";
link.innerHTML = 'Download as CSV';
恐怕你可以通过这种方式做到这一点。 Microsoft Internet Explorer 有一个 limit up to 2048 characters 的 URI。
相反,您最好从不同的页面提供此 CSV 并指向 IE 从那里获取或使用 msSaveOrOpenBlob
示例:
navigator.msSaveOrOpenBlob(new Blob(CSV.split('')), { type: 'text/csv' }), fileName + ".csv");
*仅适用于 IE 10 及更高版本