在 Cordova 3.6 中使用 iframe 和 jquery 移动对话框弹出窗口使用谷歌文档查看器显示文档 [英] Display documents using google doc viewer using iframe and jquery mobile dialog popup in Cordova 3.6

查看:31
本文介绍了在 Cordova 3.6 中使用 iframe 和 jquery 移动对话框弹出窗口使用谷歌文档查看器显示文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 google doc 查看器中显示文本文档,该查看器位于 iframe 内,然后在 jquery 移动对话框内.我正在使用cordova 3.6并在iOS上尝试这个.

这是我目前的代码:

<iframe id="myIframe" src="" style="width: 100%; height: 100%;"></iframe>

<button href="foo.html" id="opener" data-rel="dialog" data-transition="pop">打开对话框</button>

功能:

jquery 使用:

<script src="//code.jquery.com/jquery-1.10.2.js"></script><script src="//code.jquery.com/ui/1.11.1/jquery-ui.js"></script>

在浏览器上这按要求工作,但在 Cordova 上不工作.iframe 已经加载了 pdf,单击按钮没有任何反应.那么这是不可能的还是我遗漏了什么?

谢谢.

解决方案

您可以使用已经讨论过的 inappbrowser 插件 此处.

最好

M

I'm trying to display text documents inside google doc viewer which is inside an iframe which is then inside an jquery mobile dialog. I'm using cordova 3.6 and trying this on iOS.

Here's my code so far:

<div data-role="page" id="dialog">
<iframe id="myIframe" src="" style="width: 100%; height: 100%;" ></iframe>
</div>
<button href="foo.html" id="opener" data-rel="dialog" data-transition="pop">Open Dialog</button>

the functions:

<script>
 $(function () {
            $("#dialog").dialog({
                autoOpen: false,
                show: "fade",
                hide: "fade",
                modal: true,
                open: function (ev, ui) {
                    $('#myIframe').src = 'http://docs.google.com/viewer?url=http://www.relacweb.org/conferencia/images/documentos/Hoteles_cerca.pdf';
                },
                height: 'auto',
                width: 'auto',
                resizable: true
//                title: 'Vessels'
            });

            $("#opener").click(function () {
                $("#dialog").dialog("open");
                return false;
            });
</script>

jquery used:

<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.1/jquery-ui.js"></script>

On the browser this works as required but not on Cordova. The iframe is already loaded with the pdf and nothing happens with the button click. So is it just not possible or am i missing something?

Thanks.

解决方案

You can use the inappbrowser plugin which has been discussed here.

best

M

这篇关于在 Cordova 3.6 中使用 iframe 和 jquery 移动对话框弹出窗口使用谷歌文档查看器显示文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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