Fórum

<a download> not working

Neelesh Sahay, modificado 6 Anos atrás.

<a download> not working

New Member Postagens: 14 Data de Entrada: 21/07/17 Postagens Recentes
Hi, I have an application which generates a URL which allows the user to download a USER manual e.g
http://localhost:8080/o/myportlet-portlet/docresource/MYAPP%206.0-1.0%20UM.pdf

When clicked within the site, a page with characters appears on the screen.

If I copy the link and paste it on another tab, it opens up the doc.

What I would like it to do is have the document downloaded when we click on the URL.

In the JSP we have
<a id="userManualLink" href="http://localhost:8080/o/myportlet-portlet/docresource/MYAPP%206.0-1.0%20UM.pdf" download>User Manual</a>

Thanks,
Neelesh
thumbnail
Amos Fong, modificado 6 Anos atrás.

RE: <a download> not working

Liferay Legend Postagens: 2047 Data de Entrada: 07/10/08 Postagens Recentes
Hi Neelesh,

What you want to do is make sure the content-disposition header is set correctly:
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition