0

I am working in ASP.NET environment and need to download PDF from Media library ( Sitecore ) on anchor click event.

<a  style="cursor: pointer;" href="https://mypdf.pdf" download="mypdf">Download PDF </a>

Given attribute downloading file in Chrome but not in Firefox and IE9/10.

Am I missing something to add in given anchor.

Jan Bluemink
  • 3,467
  • 1
  • 21
  • 35
Shailesh
  • 554
  • 1
  • 6
  • 29
  • 2
    [IE doesn't support the download attribute](http://caniuse.com/#feat=download), and [Firefox only permits it for files on the same origin for security reasons](http://stackoverflow.com/questions/28318017/html5-download-attribute-not-working-when-downloading-from-another-server-even). – Alexander O'Mara Jun 08 '15 at 05:35
  • @AlexanderO'Mara: Well commented, useful comment. :) – Nad Jun 08 '15 at 06:12
  • Which version of Sitecore are you using? Is the PDF stored in the Media Library? In Sitecore 7.2+ any PDF served from media library will trigger a download/save rather than opening in browser. – jammykam Jun 08 '15 at 09:07
  • Sitecore 7.5. Yes My PDFs are in Media Library. Also I need to implement 2 feature. First on 1 anchor click PDF should downland and other anchor click It Should open in new browser Tab – Shailesh Jun 08 '15 at 10:00

0 Answers0