Search code examples
amazon-s3google-docsgoogle-document-viewer

Google Doc's Viewer


I'm trying to get Google Docs Viewer to load a pptx file stored on my Amazon S3 account and it fails for some reason. I put the same file on my dev server and everything loads fine.

 <!--- This one works --->
<iframe src="http://docs.google.com/gview?url=http://www.myURL.com/iframe-ppt-demo/demo.pptx&embedded=true" style="width:600px; height:500px;" frameborder="0"></iframe>

 <!--- This one does not works --->
<iframe src="http://docs.google.com/viewer?url=https://myS3Bucket.s3.amazonaws.com/demo.pptx&embedded=true" style="width:600px; height:500px;" frameborder="0"></iframe>

I can download from the S3 link just fine and I made sure that everyone had open/download premssion set. Does Google Docs not allow S3 files???


Solution

  • I have a similar problem where I could access a pdf from one server, but not the other. I was stumped for a while but I have now found that I believe the reason for this is because it seems Google has a XSS policy which prevents you from 'viewing' a pdf from a different server.

    If the file embedding the pdf is on a different site (different protocol, host or port) then Google will not allow it to be loaded.

    I hope this helps.