在<a> tag not working in Edge

时间:2018-10-05 09:17:12

标签: angular html5

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?

1 个答案:

答案 0 :(得分:1)

以下版本的边缘浏览器支持

下载属性,请确保您使用的边缘版本> = 17

参考:https://caniuse.com/#search=download

enter image description here