Forum Discussion

Koloris's avatar
Koloris
Copper Contributor
Jun 12, 2020

Display Template Error

I'm working in SharePoint 2013 and I've customised a display template to show a library of images and some text.  Upon clicking the thumbnail, I want the image to download, as opposed to open in a new tab or open the image in the library.

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="_#= pictureURL =#_" which I thought would mean the image would download and the name would be the picture URL.

It works great for me and I was very happy. So I published my new display template 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  and it's driving me insane trying to work it out what the problem is, so please help

No RepliesBe the first to reply

Resources