-2

I'm trying to make a button which will download one of my HTML projects but instead of downloading it just loads that HTML into the page and redirects the page there.

I've tried the download attribute and form action solution and both have failed me.

<th>
   <h3>Example Form</h3>This project taught me how to build a form 
   that you can put into a website for someone to fill out.<br />
   <form method="get" action="projects/IlanTretiak1.5-Forms.html">
   <button type="submit"> Download </button>
   </form>
   <form action="projects/IlanTretiak1.5-Forms.html">
   <button formtarget="_blank"> Visit </button>
   </form>
</th> 
SuperDJ
  • 7,488
  • 11
  • 40
  • 74
  • 1
    The `download` attribute on a normal link should work in modern browsers. Just making a GET request via a form submit of course doesn’t trigger a download for normal HTML document, there is little difference between that and just following a normal link to the page. – 04FS Jan 29 '19 at 09:02
  • https://stackoverflow.com/questions/2793751/how-can-i-create-download-link-in-html – MattHamer5 Jan 29 '19 at 09:02
  • 1
    Ideally though your web server should set a `Content-Disposition` HTTP header to trigger the download behaviour. – deceze Jan 29 '19 at 09:04

1 Answers1

0

you need to add download attribute to make it worked

<a href="your source here" download>Download</a>

refer for more info link

Rahul
  • 4,294
  • 1
  • 10
  • 12