'HTML Code to Trigger Download on a Webpage

I'm trying to write a program that does the following in HTML.

Creates a button that links to a webpage. Inside the webpage there is a button that triggers an Excel file download.

I'd like my code to open the link and download the file in one click.

P.S. I already created the button that opens webpage.

Open to other language solutions.

Thanks!



Solution 1:[1]

I have created this for you. I have tested it as well.

 <a href="location-to-your-excel.xls">
      <button>
        ButtonName
      </button>
 </a>

You need to put your excel file in the project folder also. Hope it helps! Cheers from Hungary.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Balázs Patai