open link inside the phonegap program
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 an开发者_运维百科d data-ajax="false" but everything is failing and opening in the mobile browser, can some one help me please?
you could maybe try putting an iframe and open the link in that?
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
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
Use the childbrowser
plugin for Phonegap. That will open the link inside the app only.
精彩评论