在PhoneGap应用程序中的远程JQueryMobile网站中的链接打开safari [英] Links in remote JQueryMobile sites in a PhoneGap app open safari

查看:174
本文介绍了在PhoneGap应用程序中的远程JQueryMobile网站中的链接打开safari的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在PhoneGap和JQuery Mobile上使用这两个框架的最新版本有一个特殊的问题。

I'm having quite a peculiar problem with PhoneGap and JQuery Mobile, using the latest versions of both frameworks as of this writing.

我的phonegap应用程序有一些页面'本地'到应用程序,以及直接从远程站点加载的其他页面。在本地和远程页之间是好的(没有转变,但不能完全有所帮助)。但是,一旦我在远程页面上,任何链接,我点击远程页面打开Safari与我请求的页面。这是不可取的功能,因为我希望它都在UIWebView内,没有任何链接被标记任何特殊的,将导致Safari打开。

My phonegap app has some pages 'local' to the app, and other pages that are loaded directly from a remote site. Going between the local and remote pages is fine (there is no transition but that can't exactly be helped). However, once I'm on the remote pages, any link I click on the remote pages opens Safari with the page I requested. This is not desirable functionality, as I would like it all to be within the UIWebView, and none of my links are marked with anything special that would cause Safari to open.

它得到weirder。如果我然后从Safari切换回程序,我请求的远程页面出现在UIWebView,但按下后退按钮导致我不是第一个远程页面,但第一个本地页面。

It gets weirder. If I then switch from Safari back to the program, the remote page I requested appears in the UIWebView, however pressing the back button leads me not to the first remote page, but the first local page.

phonegap应用程序现在是相当裸,非常接近默认,除了JQM css + js加载。即使我创建一个简单的测试应用程序,它有一个本地JQM页面,一个远程JQM页面,然后远程页面从一个JQM远程页面链接。

The phonegap app right now is quite bare, very close to the default except with JQM css + js loaded. This happens even if I create a simple test app that has one local JQM page, one remote JQM page and then a remote page that is linked to from a JQM remote page.

我被骗了。这是怎么回事?

I'm stumped. What's going on here?

推荐答案

PhoneGap的默认行为是在Safari中打开外部链接,除非他们被添加到ExternalHosts属性在PhoneGap.plist中。

The default behavior for PhoneGap is to open external links in Safari unless they are added to the ExternalHosts property in PhoneGap.plist.

尝试添加外部主机,PhoneGap应该正确运行并加载应用程序内部的外部位置。

Try adding the external hosts and PhoneGap should behave correctly and load the external locations inside of the application.

这里还有一个帖子,了解如何使用iFrame和ExternalHosts,这也可能有所帮助。

Here also is a post about using iFrames and ExternalHosts that could be of some help as well.

这篇关于在PhoneGap应用程序中的远程JQueryMobile网站中的链接打开safari的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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