Source Code:
(back to article)
Submit
Result:
Report an issue
<!DOCTYPE html> <html> <head> <title>Title of the Document</title> </head> <body> <!-- The download attribute causes the browser to download instead of navigating --> <a download="welcome.txt" href='#' id="link">Download</a> <script> let blob = new Blob(["Welcome to W3Docs"], {type: 'text/plain'}); link.href = URL.createObjectURL(blob); </script> </body> </html>