Svh91
Svh91

Reputation: 73

Download attribute on <a> tag not working in Edge

I use the following piece of HTML to let a user download documents from the server:

    <tr *ngFor="let document of documents">
      <td><a href="/api/file/GetDocumentById?id={{document.id}}" download="{{document.name}}">{{document.name}}</a></td>
    </tr>

Here, the download attribute sets the name of the downloaded file. This works in Chrome, but I just discovered that when using Edge, the file gets the name of the controller (GetDocumentById) instead.

Does anyone have an easy solution that sets the name of the downloaded file correctly?

Upvotes: 2

Views: 1324

Answers (1)

Pandiyan Cool
Pandiyan Cool

Reputation: 6565

Download attribute is supported in following version of edge browser, make sure you are using edge version >= 17

Reference: https://caniuse.com/#search=download

enter image description here

Upvotes: 1

Related Questions