Use the download
attribute:
<a download='FileName' href="https://stackoverflow.com/questions/283956/your_url">
The download
attribute works on Chrome, Firefox, Edge, Opera, desktop Safari 10+, iOS Safari 13+, and not IE11.
More Related Contents:
- Convert HTML to data:text/html link using JavaScript
- Should setting an image src to data URL be available immediately?
- Pass vars to JavaScript via the SRC attribute
- SecurityError: The operation is insecure – window.history.pushState()
- What are the differences between history.pushState & location.hash? [closed]
- Get HTML code using JavaScript with a URL
- Cross-browser Save As .txt
- Remove fragment in URL with JavaScript w/out causing page reload
- Javascript-Setting background image of a DIV via a function and function parameter
- How to display an chage photo option on mouse hover similar to linkedin using Javascript? [closed]
- How to force browser to show image 3 inches wide?
- HTML Form Submit pass array to PHP [closed]
- Detect which word has been clicked on within a text
- Can scripts be inserted with innerHTML?
- How do I detect keypresses in Javascript?
- Open window in JavaScript with HTML inserted
- prevent Scroll bubbling from element to window
- Detecting that the browser has no mouse and is touch-only
- Set keyboard focus to a
- How to detect when history.pushState and history.replaceState are used? [duplicate]
- How to prevent html/JavaScript code modification
- Detect browser wrapped lines via javascript
- Multiple read more / read less sections are not working on a page
- HTML5 Dynamically create Canvas
- Drawing lines on html page
- Measuring text width/height without rendering
- Sending mail from HTML page with image in the body
- Wrapping lists into columns
- contenteditable div backspace and deleting text node problems
- HTML5 Notification not working in Mobile Chrome