3

I embed documents via a Google doc viewer iframe into my site:

$('#previewContainer')
    .html('<iframe src="http://docs.google.com/viewer
           ?url=www.mysite.com/dev1/myfile.txt''&#038;embedded=true" width="400" height="400" style="border: none;"></iframe>') 
    });

I would like to do the same thing, but for files included in a protected user area i.e link to the file is not public.

I'm thinking of creating a public "cache" folder on which I would store the file temporarily for using in Google doc viewer, then delete the file, but I am looking, if it exists, for a more simple solution...

Is there any possibility in jQuery or php to temporarily make the link public (for ex an edit of the htaccess rule) ?

Absolutely no idea how to fix that, thanks a lot for your time.

Darshan Miskin
  • 844
  • 14
  • 25
Vincent Teyssier
  • 2,146
  • 5
  • 25
  • 62
  • 1
    The issue is that once you have used Google Doc Viewer for your temporary public document, Google caches it and indexes it to allow other users to find it. See this related discussion: https://productforums.google.com/forum/#!topic/docs/wmgpk9N8LrU – Delgan Jul 28 '15 at 13:55
  • Thanks, do you know any other embeddable viewer I could use instead ? Need to display pdf, word docs and images – Vincent Teyssier Jul 29 '15 at 08:15
  • 1
    I am looking for such a viewer too. :/ I heard about [GroupDocs Viewer](http://groupdocs.com/apps/viewer) but never tried it, unfortunately this is not free. – Delgan Jul 29 '15 at 08:27
  • 1
    @delgan I found this one : http://jquery.malsup.com/media/ Will integrate it next week and let you know – Vincent Teyssier Jul 31 '15 at 15:47
  • Good to know, thank you! – Delgan Jul 31 '15 at 17:18
  • 1
    @delgan I ve just tried it and it is very good to display pdf and pics, but does not support word, excel, text docs. I'll continue searching for other alternatives, but one solution could be to use this one for pics and pdf, then use phpword and phpexcel on a server side script that you call in ajax to display word and excel docs – Vincent Teyssier Aug 01 '15 at 10:15
  • Is free this service in 2021 for comercial or has price link? – Carlos Nov 28 '21 at 20:45

0 Answers0