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

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

问题描述

我试图在google doc查看器中显示文本文档,该文档在iframe中,然后在jQuery移动对话框中。我使用cordova 3.6并在iOS上尝试这个。



这里是我的代码到目前为止:

 < div data-role =pageid =dialog> 
< iframe id =myIframesrc =style =width:100%; height:100%; >< / iframe>
< / div>
< button href =foo.htmlid =openerdata-rel =dialogdata-transition =pop>打开对话框< / button>

功能:

 < 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)。 b $(#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/111.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中使用google doc viewer使用iframe和jquery移动对话框弹出窗口显示文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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