html - 如何使用 google doc iframe 禁用 pdf 查看器中的弹出选项?

标签 html iframe google-docs google-document-viewer

我正在使用以下代码使用带有 iframe 的谷歌显示 pdf。它工作正常。 但我想禁用显示在我网页右上角缩放选项旁边的“弹出”选项(点击打开我的 pdf 在新选项卡中使用 google 文档)。可能吗?

目前我正在使用以下代码-

<iframe src="http://docs.google.com/gview?url=http://example.com/files/myfile.pdf&embedded=true" style="width:600px; height:500px;" frameborder="0">

最佳答案

可以使用 sandbox 来阻止 popupiframe 中工作

<iframe 
    sandbox="allow-scripts allow-same-origin"
/>

allow-scripts:在 iframe 中运行 javascript。
allow-same-origin:允许从 google viewer 加载文件。
如果没有 allow-popups,当用户点击 pop-out 图标时什么也不会发生。

来源:https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe

关于html - 如何使用 google doc iframe 禁用 pdf 查看器中的弹出选项?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29349556/

相关文章:

google-sheets - 如果当前单元格存在于某个范围内,则在 Google Docs 中应用条件格式

google-apps-script - MailApp.sendEmail 不工作?

html - 我无法运行 npm run script 它显示了许多错误

javascript - iOS Safari 的 iframe 无法获取设备方向和运动事件

jquery在加载时获取iframe内容的高度

asp.net - 在 asp.net c# 中使用 iframe 从网页中检索选定的文本?

google-sheets - 删除单元格谷歌电子表格中的换行符

html - 制作一个所有内容垂直对齐的 CSS 标题

html - 居中文本时如何继承父div?

javascript - ng-keypress 调用 angularjs 中的函数