[
https://issues.apache.org/jira/browse/CB-362?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13279805#comment-13279805
]
Randy McMillan edited comment on CB-362 at 5/20/12 4:13 PM:
------------------------------------------------------------
-(BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest
*)request navigationType:(UIWebViewNavigationType)navigationType;
{
NSURL *requestURL =[ [ request URL ] retain ];
if ( ( [ [ requestURL scheme ] isEqualToString: @"http" ] || [ [ requestURL
scheme ] isEqualToString: @"https" ] || [ [ requestURL scheme ]
isEqualToString: @"mailto" ])
&& ( navigationType == UIWebViewNavigationTypeOther ) ) {
return ![ [ UIApplication sharedApplication ] openURL: [ requestURL
autorelease ] ];
}
[ requestURL release ];
return YES;
}
Further testing indicates that the above provides the desired functionality of
using _self and _blank on the same domain.
was (Author: randymcmillan):
-(BOOL)webView:(UIWebView *)webView
shouldStartLoadWithRequest:(NSURLRequest *)request
navigationType:(UIWebViewNavigationType)navigationType;
{
NSURL *requestURL =[ [ request URL ] retain ];
if ( ( [ [ requestURL scheme ] isEqualToString: @"http" ] || [ [ requestURL
scheme ] isEqualToString: @"https" ] || [ [ requestURL scheme ]
isEqualToString: @"mailto" ])
&& ( /*navigationType == UIWebViewNavigationTypeLinkClicked ||*/
navigationType == UIWebViewNavigationTypeOther ) ) {
return ![ [ UIApplication sharedApplication ] openURL: [ requestURL
autorelease ] ];
}
[ requestURL release ];
return YES;
}
Further testing indicates that the above provides the desired functionality of
using _self and _blank on the same domain.
> [ios] target="_blank" links should open in browser (ignoring externalhosts)
> ---------------------------------------------------------------------------
>
> Key: CB-362
> URL: https://issues.apache.org/jira/browse/CB-362
> Project: Apache Cordova
> Issue Type: Bug
> Components: iOS
> Affects Versions: 1.5.0
> Reporter: Andrew Lunny
> Assignee: Shazron Abdullah
> Labels: externalhosts, whitelist
> Fix For: 1.8.0
>
> Attachments: addGoogle.png, blanknotrejected.png, googleOpened.png,
> index.html.png, linkOpenedInSafari.png, openInSafari.zip,
> phonegap.com.both.png, phonegap.png, self_rejected.png, senchaOne.png,
> senchaTwo.png, whitelist.png
>
>
> A link such as this:
> {noformat}<a href="http://google.com" target="_blank">Google</a>{noformat}
> should open by default in the device's web browser, without being explicitly
> allowed in the plist (externalhosts).
> This is the current (and, imo, expected) behaviour on Android.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira