<form method="get" action="/app/PoiTemplate/NFC.xlsx">
<button type="submit">Download!</button>
</form>
window.open("/app/PoiTemplate/NFC.xlsx")
Both of the above methods have opened the file. Is there any other downloading method?
The following is the header of php, try it yourself
Although IE does not recognize the download attribute, it is still a link under IE, so we can add a
target="black"
attribute to open a new window and implement downloading, so it can be implemented as follows:Your problem is not with the front end. Another way of thinking is to download through the back end, initiate a get request at the front end, and set the return header Content-Disposition: Attachment; filename="file name" in the back end in the form of a stream. , the browser will naturally pop up the file selection box. Here is a java example https://github.com/treeandgra...
Second idea:
/q/10...
Based on my experience, your problem should be caused by the browser, try another browser
The characteristic of javascript lies in the operation and reference of DOM and BOM. File download is a feature of Meta. JavaScript has no permission to operate. Just let the back-end developer set the output Head Meta.