在HTML5应用程序中使用IFRAME [英] Using IFRAME in HTML5 applications

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

问题描述

我在写一个HTML5移动应用程序,并使用PhoneGap将其推送到iPad。该应用程序类似于iPad的Twitter应用程序,它列出了一大堆项目,让用户点击这些项目,并可能在应用程序中加载外部链接。

I'm writing an HTML5 mobile application, and using PhoneGap to push it to the iPad. The application is similar to the Twitter application for iPad, in that it lists a bunch of items, lets users click on those items, and potentially loads an external link within the app. Facebook does this as well with their applications.

在HTML5应用程序中编写加载外部内容的应用程序在这一点上证明是一个糟糕的体验。我可以在页面上转储一个IFRAME,但不支持在iPad上滚动开箱。我做了一些hacky的东西,把iscroll4连接到iframe,但它是非常不一致。脚本可以跳转iframe并尝试突破。引发安全错误。您必须修改PhoneGap源以允许来自iframe的外部请求。我不能对meta视口做任何假设,因为源是外部的。列表继续...

Writing an application that loads external content in an HTML5 application has proven to be an awful experience to this point. I can dump an IFRAME on the page, but that doesn't support scrolling on the iPad out of the box. I've done some hacky things to wire up iscroll4 to the iframe, but it's wildly inconsistent. Scripts can jump the iframe and try to break out. Security errors are thrown. You have to modify the PhoneGap source to allow external requests from the iframe. I can't make any assumptions about meta viewport, because the source is external. The list goes on...

我可以解决很多这些事情与个人的黑客工作和黑魔法,但这一次,我感觉就像那里必须是一个更好的方式。有没有一个组件在那里工作所有这些东西?我觉得像JavaScript的内部浏览器的本地包装器将解决很多这些问题,但似乎找不到类似的东西 - 其他人使用什么?

I can fix a lot of these things with individual hack work arounds and dark magic, but this whole time I've felt like there just has to be a better way. Is there a component out there that works around all this stuff? I've felt like a native wrapper for the browser inside of JavaScript would fix a lot of these issues, but can't seem to find anything like it - what is everyone else using?

注意:我刚刚发现了浏览器手机插件 - 我猜这将是一个流行的选择: - )

Note: I just discovered the browser phone-gap plugins - I'm guessing this will be a popular choice :-)

推荐答案

kvc大多是正确的。答案是使用ChildBrowser phonegap插件,但有一些修改,以获得我所需要的。

kvc was mostly right on. The answer was to use the ChildBrowser phonegap plugin, but with a few modifications to get exactly what I needed.

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

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