0

Hi guys I'm making a phonegap + jquery mobile program, the problem is that I've got a listview in the phonegap that is being loaded by an external site, in the leaf of the list have an a href to a site with the html that i want to be opened in the program. When I click in the leaf it opens the link in the mobile browser instead of the phonegap program, and I would like to make it open the links inside the program instead of the mobile browser.

I've already tried rel=external and data-ajax="false" but everything is failing and opening in the mobile browser, can some one help me please?

Waynn Lue
  • 11,344
  • 8
  • 51
  • 76
talles_jp
  • 143
  • 3
  • 13
  • http://stackoverflow.com/questions/5911255/phonegap-for-iphone-problem-loading-external-url/7779187#7779187 – esamatti Oct 15 '11 at 16:47

4 Answers4

0

I was trying to accomplish a similar thing by making IFrames embed in the app (instead of opening in a browser )and this fixed the issue for me . In Xcode, modify the AppDelegate.m file, replace the shouldStartLoadWithRequest section with this:

- (BOOL)webView:(UIWebView *)theWebView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
{
    NSURL *url = [request URL];
    if ([[url scheme] isEqualToString:@"http"] || [[url scheme] isEqualToString:@"https"]) {
        return YES;
    }
    else {
        return [ self.viewController webView:theWebView shouldStartLoadWithRequest:request navigationType:navigationType ];
    }
}

this is for Cordova 1.5.x,, on iOS obviously

29er
  • 8,595
  • 12
  • 48
  • 65
0

you could maybe try putting an iframe and open the link in that?

ghostCoder
  • 1
  • 9
  • 49
  • 72
  • no , I cant use Iframe , i need to change the content of the phonegap program to the page that it links , im using in some parts the load() function of jquery but i dont know how to use it inside an jquery mobile listview. – talles_jp Oct 13 '11 at 20:29
0

Here's how you'd do it in Android:

PhoneGap for iPhone: problem loading external URL

A similar mechanism exists for iOS. You can specify external URLs that should not be launched in an external browser in PhoneGap.plist

Community
  • 1
  • 1
nisc
  • 4,222
  • 4
  • 29
  • 34
0

Use the childbrowser plugin for Phonegap. That will open the link inside the app only.

Jack
  • 10,943
  • 13
  • 50
  • 65
ghostCoder
  • 1
  • 9
  • 49
  • 72