【发布时间】:2019-02-28 19:03:20
【问题描述】:
我已经使用 iframe google drive pdf viewer 将 pdf 嵌入到我的网站中,下面是我使用过的代码
它工作正常,但我想删除出现在我网站右上角的弹出按钮,以便观众无法在我的页面之外查看]1
任何帮助将不胜感激
【问题讨论】:
标签: javascript html css pdf
我已经使用 iframe google drive pdf viewer 将 pdf 嵌入到我的网站中,下面是我使用过的代码
它工作正常,但我想删除出现在我网站右上角的弹出按钮,以便观众无法在我的页面之外查看]1
任何帮助将不胜感激
【问题讨论】:
标签: javascript html css pdf
使用此代码
<!DOCTYPE html>
<html>
<head>
<title></title>
<style type="text/css">
iframe{
height:100vh;
}
</style>
</head>
<body>
<iframe src="https://docs.google.com/viewer?url=http://www.pdf995.com/samples/pdf.pdf&embedded=true" width="100%" height="100vh" frameborder="0" scrolling="no" ></iframe>
<div style="width: 80px; height: 80px; position: absolute; opacity: 0; right: 0px; top: 0px;"> </div>
<!-- </div> -->
</body>
</html>
【讨论】:
试试下面的方法: 在弹出按钮顶部使用隐藏元素使其无法访问。或者,如果要隐藏,请移除不透明度并设置背景颜色。
<div style="width: 640px; height: 480px; position: relative;">
<iframe src="http://docs.google.com/viewer?url=YOUR PDF/DOC FILE URL &embedded=true" width="640" height="480" frameborder="0" scrolling="no" seamless=""></iframe>
<div style="width: 40px; height: 40px; position: absolute; opacity: 0; right: 12px; top: 12px;"> </div>
</div>
【讨论】:
我可以用下面的iframesandbox属性值解决这个问题:
<iframe sandbox="allow-forms allow-modals allow-orientation-lock allow-pointer-lock allow-presentation allow-same-origin allow-scripts allow-top-navigation allow-top-navigation-by-user-activation"
src=""
width="640"
height="480"
https://docs.google.com/gview?embedded=true&url="<url-your-pdf>"?t="1625427767140"></iframe>
【讨论】: