【问题标题】:How to disable pop-out option in pdf viewer with google drive embedded iframe如何使用谷歌驱动器嵌入 iframe 在 pdf 查看器中禁用弹出选项
【发布时间】:2019-02-28 19:03:20
【问题描述】:

我已经使用 iframe google drive pdf viewer 将 pdf 嵌入到我的网站中,下面是我使用过的代码

它工作正常,但我想删除出现在我网站右上角的弹出按钮,以便观众无法在我的页面之外查看]1

任何帮助将不胜感激

【问题讨论】:

    标签: javascript html css pdf


    【解决方案1】:

    使用此代码

    <!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;">&nbsp;</div>
    <!-- </div> -->
    </body>
    
    </html>
    
    

    【讨论】:

      【解决方案2】:

      试试下面的方法: 在弹出按钮顶部使用隐藏元素使其无法访问。或者,如果要隐藏,请移除不透明度并设置背景颜色。

      <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;">&nbsp;</div>
       </div>
      

      【讨论】:

        【解决方案3】:

        我可以用下面的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>
        

        【讨论】:

        • 太棒了,让我头疼不已
        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2016-09-20
        • 1970-01-01
        • 1970-01-01
        • 2014-08-14
        • 2011-01-16
        • 1970-01-01
        • 2019-12-25
        相关资源
        最近更新 更多