Javascript windows.open()之后未开始下载
我有一个生成和下载文件的控制器。 当用户点击“下载”按钮时,执行以下代码:Javascript windows.open()之后未开始下载,javascript,java,jquery,html,spring-mvc,Javascript,Java,Jquery,Html,Spring Mvc,我有一个生成和下载文件的控制器。 当用户点击“下载”按钮时,执行以下代码: \u statusWindow=window.open('downloadcv',“\u statusWindow”); _statusWindow.document.write('请稍候,我们正在处理您的请求'); _statusWindow.document.title=“正在下载…”我怀疑在下载完成之前,消息是否会留在窗口中,请您尝试一下下面的代码 var win = window.open("","_statu
\u statusWindow=window.open('downloadcv',“\u statusWindow”);
_statusWindow.document.write('请稍候,我们正在处理您的请求');
_statusWindow.document.title=“正在下载…”代码>我怀疑在下载完成之前,消息是否会留在窗口中,请您尝试一下下面的代码
var win = window.open("","_statusWindow");
var html = '<html><head></head><body>Please wait while we processing your
request...</body></html>';
var iframe = win.document.createElement('iframe');
iframe.src = 'data:text/html;charset=utf-8,' + encodeURI(html);
iframe.onload = window.open("downloadCSV","_statusWindow");
win.document.body.appendChild(iframe);
var-win=window.open(“,”_statusWindow”);
var html='我们正在处理您的文件,请稍候
请求……';
var iframe=win.document.createElement('iframe');
iframe.src='数据:text/html;字符集=utf-8,'+encodeURI(html);
iframe.onload=window.open(“downloadcv”,“u statusWindow”);
win.document.body.appendChild(iframe);
我怀疑在下载完成之前,该消息是否会保留在窗口中,请您尝试一下下面的代码
var win = window.open("","_statusWindow");
var html = '<html><head></head><body>Please wait while we processing your
request...</body></html>';
var iframe = win.document.createElement('iframe');
iframe.src = 'data:text/html;charset=utf-8,' + encodeURI(html);
iframe.onload = window.open("downloadCSV","_statusWindow");
win.document.body.appendChild(iframe);
var-win=window.open(“,”_statusWindow”);
var html='我们正在处理您的文件,请稍候
请求……';
var iframe=win.document.createElement('iframe');
iframe.src='数据:text/html;字符集=utf-8,'+encodeURI(html);
iframe.onload=window.open(“downloadcv”,“u statusWindow”);
win.document.body.appendChild(iframe);
你能试一试吗,我正在尝试以iframe的形式打开下载,并在加载iframe时关闭窗口。。希望它能起作用
var win = window.open("","_statusWindow");
var html = '<html><head><title>Base</title></head><body>Please wait while
we processing your request...</body></html>';
var iframe = win.document.createElement('iframe');
iframe.src = 'data:text/html;charset=utf-8,' + encodeURI(html);
win.document.body.appendChild(iframe);
var iframe2 = win.document.createElement('iframe');
iframe2.src = "downloadCSV";
iframe2.onload= win.close();
win.document.body.appendChild(iframe2);
var-win=window.open(“,”_statusWindow”);
var html='请稍候
我们正在处理您的请求;
var iframe=win.document.createElement('iframe');
iframe.src='数据:text/html;字符集=utf-8,'+encodeURI(html);
win.document.body.appendChild(iframe);
var iframe2=win.document.createElement('iframe');
iframe2.src=“下载CSV”;
iframe2.onload=win.close();
win.document.body.appendChild(iframe2);
你能试一试吗,我正在尝试以iframe的形式打开下载,并在加载iframe时关闭窗口。。希望它能起作用
var win = window.open("","_statusWindow");
var html = '<html><head><title>Base</title></head><body>Please wait while
we processing your request...</body></html>';
var iframe = win.document.createElement('iframe');
iframe.src = 'data:text/html;charset=utf-8,' + encodeURI(html);
win.document.body.appendChild(iframe);
var iframe2 = win.document.createElement('iframe');
iframe2.src = "downloadCSV";
iframe2.onload= win.close();
win.document.body.appendChild(iframe2);
var-win=window.open(“,”_statusWindow”);
var html='请稍候
我们正在处理您的请求;
var iframe=win.document.createElement('iframe');
iframe.src='数据:text/html;字符集=utf-8,'+encodeURI(html);
win.document.body.appendChild(iframe);
var iframe2=win.document.createElement('iframe');
iframe2.src=“下载CSV”;
iframe2.onload=win.close();
win.document.body.appendChild(iframe2);
它可以工作!非常感谢,但我想在下载完成后关闭此窗口。我试过:$(win.document).ready(win.close());但它会马上关上窗户。我认为这会起作用,因为当我下载smth时,我在浏览器选项卡的左上角有一个微调器,所以文档还并没有准备好。但它不起作用。下载完成后,您对如何关闭选项卡有何建议?在我的示例中,当下载完成时,窗口将自动关闭Edit works!非常感谢,但我想在下载完成后关闭此窗口。我试过:$(win.document).ready(win.close());但它会马上关上窗户。我认为这会起作用,因为当我下载smth时,我在浏览器选项卡的左上角有一个微调器,所以文档还并没有准备好。但它不起作用。下载完成后,您对如何关闭选项卡有何建议?在我的示例中,当下载完成时,窗口将自动关闭