使用javascript-jquery在Google文档查看器中隐藏弹出窗口 [英] hide pop-out in google docs viewer using javascript-jquery

查看:90
本文介绍了使用javascript-jquery在Google文档查看器中隐藏弹出窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Google文档查看器在我的应用程序的对话框中显示word和PDF文件.但是我的客户需要该文档不应该下载.因此要隐藏弹出"选项.请帮我.以下是我的代码段:

I am using google docs viewer to display word and PDF files in dialog in my application. But my client need that document should not get download. So want to hide 'Pop-out' option. Please help me for it. Below is my code snippet :

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.9/jquery-ui.js" type="text/javascript"></script>
<link href="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.9/themes/blitzer/jquery-ui.css" rel="stylesheet" type="text/css" />

<script type="text/javascript">
    $(function () {
        $("#btnShow").click(function () {
            $("#dialog").dialog({
                modal: true,
                title: '',
                width: 750,
                height: 450,
                buttons: {
                    Close: function () {
                        $(this).dialog('close');
                    }                   
                },
                open: function () {
                    var object = "<iframe id='resViewer' src='https://docs.google.com/viewer?url=my_file.pdf&embedded=true' style='width: 700px; height: 700px;' frameborder='0'></iframe>";                    

                    $("#dialog").html(object);
                }
            });
        });
    });
</script>
<input id="btnShow" type="button" value="Show PDF" />
<div id="dialog" style="display: none">
</div>

请帮助我.

如果有人知道其他方式来显示Word和PDF文件,那么我都会为此提供建议或建议.

If anyone knows any other way to display word and PDF file both give me way or suggest for this.

谢谢.

推荐答案

以下CSS将删除弹出按钮.

The following CSS will remove the pop out button.

div[aria-label="Pop-out"] {
    display: none;
}
div["aria-label=toolbar"] {
    width: 52px;
}

但是要使CSS应用于iframe,您将不得不做一些技巧.参见 jQuery,在iframe中选择元素,该元素位于iframe中如何将CSS应用于iframe?

But to get the CSS to apply to the iframe your going to have to do some trickery. See jQuery, select element inside iframe, which is inside an iframe and How to apply CSS to iframe?

这篇关于使用javascript-jquery在Google文档查看器中隐藏弹出窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆