如何在嵌入 webview iframe 的 google docs gview 中启用/显示下载按钮

问题描述 投票:0回答:1

我有一个 cordova/ionic 应用程序,可以使用 gview 在 iframe 中成功嵌入 Office 文件(IE:pdf、doc、xls)。但是,用户只能查看文档,现在出现了用户下载文件的方法。

https://docs.google.com/gview?url=" +$scope.docPath+ "&embedded=true"

完整的 iframe:

<iframe id="viewerFrame" style="width:100%;height:100%;" frameborder="0" sandbox="allow-scripts allow-same-origin" ng-src="https://docs.google.com/gview?url=https://exmple.com/files/5372967.pdf?t=1694794056384&amp;embedded=true"></iframe>

嵌入的链接包括传递给谷歌文档的选项;因此,要启用某种下载按钮,它必须包含在嵌入式链接中。

嵌入视图有一个“弹出”按钮。但是当嵌入到 iFrame 中时,弹出按钮会导致应用程序崩溃(我不知道为什么)...所以我隐藏了弹出按钮。

gview 似乎也没有官方文档。我确实在 gview 选项上发现了这个非常有限的 SE,但没有任何迹象表明启用了下载按钮。 https://webapps.stackexchange.com/questions/130654/all-google-docs-url-parameters-functions-commands

是否有任何 gview 选项可以显示功能正常的下载按钮?

cordova iframe google-docs google-document-viewer
1个回答
0
投票

您可以自己添加链接

 <a href="https://exmple.com/files/5372967.pdf?t=1694794056384" download>Download</span>
 <iframe ...></iframe>
© www.soinside.com 2019 - 2024. All rights reserved.