I have app with Angular frontend and Spring Boot backend. In frontend I have html button, via I want to download file. Proble is that it behaves differently on remote server and on localhost:
我有Angular前端和Spring Boot后端的应用程序。在前端我有html按钮,通过我想下载文件。问题是它在远程服务器和localhost上的行为有所不同:
-
localhost - after pressing button file is downloaded
localhost - 下载后按下按钮文件
<button download="output.txt" href="http://localhost:8080/output/output.txt"> Download </button>
-
remote server: after pressing button nothing happens
远程服务器:按下按钮后没有任何反应
<button download="output.txt" href="https://www.bla.com/output/output.txt"> Download </button>
However, if I copy the url https://www.bla.com/output/output.txt into a browser the file is downloaded.
但是,如果我将网址https://www.bla.com/output/output.txt复制到浏览器中,则会下载该文件。
1 个解决方案
#1
0
Solution was to used:
解决方案是使用:
<a download="output.txt" href="https://www.bla.com/output/output.txt">Download</a>
#1
0
Solution was to used:
解决方案是使用:
<a download="output.txt" href="https://www.bla.com/output/output.txt">Download</a>