0

I've customised a display template for a catalogue of images, and upon clicking the thumbnail, I want the image to download.

So I changed the script from:

<div class="zoom-pictureOnTopImageContainer" id="_#= pictureContainerId =#_">
            <a class="cbs-pictureImgLink" href="_#= linkURL =#_" title="_#= $htmlEncode(line1) =#_" id="_#= pictureLinkId =#_">_#= pictureMarkup =#_      

To:

<a class="cbs-pictureImgLink" href="_#= linkURL =#_" title="_#= $htmlEncode(line1) =#_" id="_#= pictureLinkId =#_" download="_#= pictureURL =#_">_#= pictureMarkup =#_

So I added download and to name it the picture URL.

It works great in Chrome and I was very happy. Checked it in and now my users just get Something Went Wrong where the display template should be.

If I take the download part out, the template works again for my users. I could understand if it didn't work at all, but as an administrator, it works for me, just not my users - very strange.

To add, just in case it's not obvious :-) I'm still a newbie with SharePoint, but have HTML experience with a little javascript and it's driving me insane trying to work it out, so please help

~

3
  • What browser are you're "users" using? The download attribute is only supported in modern browsers and not IE 11 e.g. – Anders Jun 13 '20 at 3:25
  • Thanks for the response - I double checked as I mostly use Chrome and it downloads in Chrome, but in IE it opens in a new window which is still fine. Just doesn't work for my users - that kind of error I would expect to have forgotten to publish, just doesn't make sense. I'm getting a full crawl run to see if makes a difference. – Koloris Jun 13 '20 at 13:33
  • Np. It was worth a shot since caniuse.com/#feat=download says it's not supported in IE. Can you instead check with you're users what error is thrown in the developer tools console? – Anders Jun 16 '20 at 5:08

Your Answer

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

Browse other questions tagged or ask your own question.