我在Google云端硬盘中保存了一个文件。
我想在嵌入iframe的网站上显示它。
我尝试使用google docs查看器,但无法使用它。
<iframe src="https://docs.google.com/gview?url={fileUrl}&embedded=true"></iframe>
如果我将文件复制到s3存储桶(或google驱动器以外的任何其他位置),并为https://s3.../filename.ext
使用fileUrl
之类的外部链接 - 它可以正常工作!
但我无法确定从Google云端硬盘使用的链接。共享和编辑链接无法正常工作。
https://drive.google.com/open?id={fileId}
分享链接。https://docs.google.com/document/d/{fileId}/edit
打开/修改链接。答案 0 :(得分:0)
经过大量试验和错误与一堆谷歌驱动器/文档链接后,我想通了。
诀窍是使用直接下载链接。 https://drive.google.com/uc?id={fileId}
所以你的iframe src应该是这样的:
<iframe src="https://docs.google.com/gview?url=https://drive.google.com/uc?id={fileId}&embedded=true"></iframe>
答案 1 :(得分:0)
这有效,没有重新加载问题。