Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

Download a copy script

$
0
0

Hi,

To make Download a copy more intuitive,we have 

Added one more column in the document library view.

Added the document library on the page,post this

We have written the below script to download the documents.

This is working for the documents except pdf i.e..

On click of the pdf doc,it's opening in the browser but not downloading.

Please share your inputs on the same.

<script type="text/javascript">
$(function(){
     //$('.ms-comm-likesMetadata').each(function(){
$('[id^="root-likesElement"]').each(function(){
var gethref = $(this).closest('tr').find('.ms-listlink').attr('href');//alert(gethref);
$(this).closest('td').next('.ms-vb-lastCell').append('<a unselectable="on" href="'+gethref+'" target="_blank" class="ms-cui-ctl-large " aria-describedby="Ribbon.Documents.Copies.Download_ToolTip" mscui:controltype="Button" role="button" id="Ribbon.Documents.Copies.Download-Large"><span unselectable="on" class="ms-cui-ctl-largeIconContainer"><span unselectable="on" class=" ms-cui-img-32by32 ms-cui-img-cont-float"><img unselectable="on" alt="" src="/_layouts/15/1033/images/formatmap32x32.png?rev=31" style=" "></span></span></a>');
});
});
function getDownload(){
 $(this).closest('td').find('.ms-listlink').trigger('click');  
}

</script>

Regards,

Sudheer


Thanks & Regards, Sudheer


Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>