0

This is a lame question, I know, but for some reason I can't get my href link to download the file properly in a cms page. I have some text, then a table, and inside one of the table cells is a link to download a file but it throws me to a 404 Not Found page. I've changed the link a couple times but can't seem to get it to work properly. Any ideas on why this is not working or why the wysiwyg removes my download="file.pdf" link?

<a href="{{media url='downloadable/file.pdf'}}" target="_blank" download="file.pdf">Download File</a>

I have also tried:

<a href="{{store url='media/downloadable/file.pdf'}}" target="_blank" download="file.pdf">Download File</a>

so the 'download="file.pdf"' gets stripped out as soon as I save my changes, so I guess the wysiwyg doesn't like html5 tags yet. But although the url is correct when I inspect it on the frontend it doesn't download the file.

~===== Answer =====~

Ok so it wasn't an issue with my link being in a cms page but rather the file location & permissions. I had my permissions set to 775 and upped them to 777 on the folder downloadable & the file itself, but for some reason moving the file to the media folder and using the following worked just fine:

<a href="{{media url='file.pdf'}}" target="_blank">Link</a>

I changed the permissions back to 775. Not sure why it didn't like being in a sub-folder.

1

Your download attribute support only in chrome and Mozilla browser. and that contain only (.img, .pdf, .txt, .html, etc.). This is new attribute OF HTML 5 But Magento WYSIWYG Editor will not provide so it will automatically truncate when you try to save cms page.

  • Good to know, thanks, but no ideas why the link won't download the file from a cms page? – Vallier Jan 7 '14 at 19:25
  • Check your anchor tag href. – Keyul Shah Jan 8 '14 at 3:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.