javascript - web app link to view any files within drive -


i have written script search drive files owned specific user- works great except function, returns results , links set open doc. pdf's , other files getting error opening because url wrong. there generic ways open files, or need write if statements? possible ideas on how around this? thanks

    function handleresults(results){           console.log('handle results called! ');           document.writeln('<a href="https://script.google.com/a/macros/35634534534534534534534534534">back</a><br/><br/>');           var length=results.length; // total elements of results           for(var i=0;i<length;i++)           {           var item=results[i];           item=item.split("|~|"); // split line |~|, position 0 has filename , 1 file id                      document.writeln("<b><a href='https://docs.google.com/document/d/"+item[1]+"' target='_blank'>"+item[0]+"</b></a> (last modified: "+item[2]+")<br/><br/>"); // write result                    }          document.writeln("end of results...");         }

thanks @spiderpig use of file.geturl();

function handleresults(results){           console.log('handle results called! ');           document.writeln('<a href="https://script.google.com/a/macros/35634534534534534534534534534">back</a><br/><br/>');           var length=results.length; // total elements of results           for(var i=0;i<length;i++)           {           var item=results[i];           item=item.split("|~|"); // split line |~|, position 0 has filename , 1 file url           // changed item1 contain file.geturl instead of fileid           document.writeln("<b><a href='"+item[1]+"' target='_blank'>"+item[0]+"</b></a> (last modified: "+item[2]+")<br/><br/>"); // write result                    }          document.writeln("end of results...");         }


Comments

Popular posts from this blog

php - Permission denied. Laravel linux server -

google bigquery - Delta between query execution time and Java query call to finish -

python - Pandas two dataframes multiplication? -