I was able to solve the problem by getting the file twice, once from the server and once from cache.
(我可以通过两次获取文件来解决问题,一次是从服务器,一次是从缓存。)
This required a Cache-Control header on the response.(这需要响应上的Cache-Control标头。)
I'm working with Angular, AdalJS, and Web Api but this might apply more broadly.(我正在使用Angular,AdalJS和Web Api,但这可能会更广泛地适用。)
I use a $http call with auth header added by AdalJS to securely retrieve the file.
(我使用带有AdalJS添加的auth标头的$ http调用来安全地检索文件。)
This response is cached by the browser.(该响应由浏览器缓存。)
When complete, I use window.open to open the cached file.(完成后,我使用window.open打开缓存的文件。)
Pop-up blocking can be a problem.
(弹出窗口阻止可能是个问题。)
If you can't disable blocking, consider displaying a second button to click when the download is complete, calling window.open from that.(如果您不能禁用阻止功能,请考虑在下载完成后显示第二个按钮以单击,然后从中调用window.open。)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…