如何在PhoneGap应用程序中嵌入iframe? [英] How do I embed iframe in PhoneGap app?

查看:299
本文介绍了如何在PhoneGap应用程序中嵌入iframe?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一个自动调度网站,在手机上呈现移动视图。我想在我的PhoneGap div中显示此网页,我可以保持我的标题和导航。常规iframe代码似乎不适合我。



这里是我目前有的:

 < div id =settitle =设置预约class =panel> 
< iframe width =320pxheight =480pxsrc =http://google.com>< / iframe>
< / div>

解决方案

这样做:

 < iframe src =http://www.myschedulingwebsite.com/style =width:100%; height:100%;> 

将高度和宽度设置为100%填充包含的div。



注意:如果您尝试使用只能在与网页本身相同原点的框架中显示的网站嵌入iframe,则Web检查器将抛出错误



拒绝显示 https://www.google.com / >,因为它将X-Frame-Options设置为 SAMEORIGIN



<说到这一点,www.google.com和其他几个网站的嵌入式iframe总是空白。我希望这有助于某人。


There is a responsive scheduling website that renders a mobile view when on a phone. I want show this webpage within my PhoneGap div that way i can keep my header and navigation. Regular iframe code seems not to work for me. Can someone give me a hint on how to get this working like in the screenshot below.

Here is what i currently have:

    <div id="set" title="Set Appointment" class="panel">
            <iframe width="320px" height="480px" src="http://google.com"></iframe>
    </div>  

解决方案

This works:

<iframe src="http://www.myschedulingwebsite.com/" style="width:100%; height:100%;">

Setting the height and width to 100% fills the containing div.

NOTE: If you attempt to embed an iframe using a website that can only be displayed in a frame on the same origin as the page itself, the web inspector will throw the error below:

Refused to display 'https://www.google.com/' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'.

With that said, www.google.com and several other site's embedded iframes will always be blank. I hope this helps someone.

这篇关于如何在PhoneGap应用程序中嵌入iframe?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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