There are a number of ways of triggering a download. Following are a few:
Use a form:
<form method="get" action="mydoc.doc">
<button type="submit">Download</button>
</form>
Use javascript:
<button type="submit" onclick="window.open('mydoc.doc')">Download</button>
More Related Contents:
- Generating HTML file using javascript and using correct MIME types like “text/html”
- download file using an ajax request
- JavaScript blob filename without link
- Download a file from NodeJS Server using Express
- How to trigger a file download when clicking an HTML button or JavaScript
- How do I download a file with Angular2 or greater
- How to get a file or blob from an object URL?
- Remember and Repopulate File Input [duplicate]
- Using HTML5/JavaScript to generate and save a file
- HTML5 File API read as text and binary
- Get page generated with Javascript in Python
- Download A File At Different Location Using HTML5
- How to convert Base64 String to javascript file object like as from file input form?
- Reading uploaded text file contents in html
- Getting binary (base64) data from HTML5 Canvas (readAsBinaryString)
- Getting byte array through input type = file
- How can I let a user download multiple files when a button is clicked?
- How to use Javascript to read local text file and read line by line?
- How FileReader.readAsText in HTML5 File API works?
- How to get file name when user select a file via ?
- How to create a dynamic file + link for download in Javascript? [duplicate]
- Download textarea contents as a file using only Javascript (no server-side)
- Writing file to desktop using HTML5 FileSystem API
- Large file upload with WebSocket
- Javascript in html write to file
- Reading multiple files with Javascript FileReader API one at a time
- Properly Create and Serve PDF Blob via HTML5 File and URL APIs
- How to save and edit a file using JavaScript?
- HTML5 File api, reading in an xml/text file and displaying it on the page?
- How to generate and prompt to save a file from content in the client browser? [duplicate]