Recently I encounter a issue that I've written the following HTML code to implement file download:
<div id="downloadLinkListEl">
<a href="./xlsx/test0.xlsx?t=1663997904033" target="_blank">test0</a>
<a href="./xlsx/test1.xlsx?t=1663997904033" target="_blank">test1</a>
<a href="./xlsx/test2.xlsx?t=1663997904033" target="_blank">test2</a>
<a href="./xlsx/test3.xlsx?t=1663997904033" target="_blank">test3</a>
</div>
The extension name of all of the above files are .xlsx, which can be opend by Microsoft Excel.
In most of the browsers, the code can be run as what we expected - after the hyperlink being clicked, a new window will be opened, then a download task will be started.
However, in Microsoft Edge (Chromium), there were two window opened, and the second window will redirect to office online viewer provide by Microsoft - this is what we unexpected.
In fact, this can be resolved by modifying the default setting of Microsoft Edge: "Open Office files in the browser" in setting
but the user experience is terrible for the end users.
So is there any possible way to download the file directly rather than redirect to office online viewer provide by Microsoft when using Edge?