Iframe 使用url在ifram中加载专用驱动器演示文稿,但同样的事情对PDF不起作用
我能够使用url、fileid和accesstoken加载私有Google Drive演示文稿ifram, 然而,同样的事情不适用于PDF 文件ID:13zxxxxxxxx-xxxxxxxxx- accessToken:ya29.xxxx-xxxx (1)工作:专用谷歌硬盘演示文稿Iframe 使用url在ifram中加载专用驱动器演示文稿,但同样的事情对PDF不起作用,iframe,google-drive-api,Iframe,Google Drive Api,我能够使用url、fileid和accesstoken加载私有Google Drive演示文稿ifram, 然而,同样的事情不适用于PDF 文件ID:13zxxxxxxxx-xxxxxxxxx- accessToken:ya29.xxxx-xxxx (1)工作:专用谷歌硬盘演示文稿 var googleDrivefileUrl1 = "https://docs.google.com/presentation/d/"+fileId+"/embed?rm=minima
var googleDrivefileUrl1 = "https://docs.google.com/presentation/d/"+fileId+"/embed?rm=minimal&access_token="+**accessToken**
var iframe1 = $('<iframe src="'+googleDrivefileUrl1+'" style="width: 90%; height: 100px">');
$('#previewDiv1').append(testIFrame1);
var googleDrivefileUrl1=”https://docs.google.com/presentation/d/“+fileId+”/embed?rm=minimal&access_-token=“++**accessToken”**
变量iframe1=$('');
$('#previewDiv1')。追加(testIFrame1);
(2)不工作:私人谷歌硬盘PDF
var googleDrivefileUrl2 = "https://docs.google.com/file/d/"+fileId+"/embed?rm=minimal&access_token="+accessToken
var iframe2 = $('<iframe src="'+googleDrivefileUrl2+'" style="width: 90%; height: 100px">');
$('#previewDiv2').append(testIFrame2);
var googleDrivefileUrl2=”https://docs.google.com/file/d/“+fileId+”/embed?rm=minimal&access\u token=“+accessToken
变量iframe2=$('');
$('#previewDiv2')。追加(testIFrame2);
谷歌是否只支持演示文稿,而不支持PDF
还是我做错了什么
我将非常感谢您的帮助和指导。您可以将谷歌硬盘上的PDF文件嵌入iFrame中,您只需换一种方式即可
googleDrivefileUrl
的格式应为
https://drive.google.com/file/d/XXX/preview
- 请注意
仅对谷歌表单、谷歌文档等谷歌文档有效https://docs.google.com
- 对于驱动器上的其他文档,URL以
https://drive.google.com
- 您还可以通过以下方式获取嵌入URL:
- 在谷歌硬盘上以预览方式打开pdf文件
- 单击“三点”并在新窗口中打开
- 再次单击“三点”并
嵌入项…
- 这将直接为您提供正确的emebdding代码语法
您”
“谁有权访问该应用程序:任何人”。然后,将WeBapp嵌入到应用程序脚本中。这样做只会使WebApp公开,而不会使PDF本身公开。