Github user tony-- commented on a diff in the pull request:
https://github.com/apache/cordova-ios/pull/232#discussion_r73512881
--- Diff:
CordovaLib/Classes/Private/Plugins/CDVIntentAndNavigationFilter/CDVIntentAndNavigationFilter.m
---
@@ -95,23 +95,33 @@ - (CDVIntentAndNavigationFilterValue)
filterUrl:(NSURL*)url
return [[self class] filterUrl:url
intentsWhitelist:self.allowIntentsWhitelist
navigationsWhitelist:self.allowNavigationsWhitelist];
}
-- (BOOL)shouldOverrideLoadWithRequest:(NSURLRequest*)request
navigationType:(UIWebViewNavigationType)navigationType
++ (BOOL)shouldOpenURLRequest:(NSURLRequest*)request
navigationType:(UIWebViewNavigationType)navigationType
+{
+ return (UIWebViewNavigationTypeLinkClicked == navigationType ||
+ (UIWebViewNavigationTypeOther == navigationType &&
+ [[request.mainDocumentURL absoluteString]
isEqualToString:[request.URL absoluteString]]
+ )
+ );
+}
+
++ (BOOL)shouldOverrideLoadWithRequest:(NSURLRequest*)request
navigationType:(UIWebViewNavigationType)navigationType
filterValue:(CDVIntentAndNavigationFilterValue)filterValue
{
NSString* allowIntents_whitelistRejectionFormatString = @"ERROR
External navigation rejected - <allow-intent> not set for url='%@'";
NSString* allowNavigations_whitelistRejectionFormatString = @"ERROR
Internal navigation rejected - <allow-navigation> not set for url='%@'";
NSURL* url = [request URL];
- CDVIntentAndNavigationFilterValue filterValue = [self filterUrl:url];
switch (filterValue) {
case CDVIntentAndNavigationFilterValueNavigationAllowed:
return YES;
case CDVIntentAndNavigationFilterValueIntentAllowed:
- // only allow-intent if it's a
UIWebViewNavigationTypeLinkClicked (anchor tag)
- if (UIWebViewNavigationTypeLinkClicked == navigationType) {
+ // only allow-intent if it's a
UIWebViewNavigationTypeLinkClicked (anchor tag) OR
+ // it's a UIWebViewNavigationTypeOther, and it's an internal
link
+ if ([[self class] shouldOpenURLRequest:request
navigationType:navigationType]){
[[UIApplication sharedApplication] openURL:url];
}
- // consume the request (i.e. no error) if it wasn't a
UIWebViewNavigationTypeLinkClicked
+
--- End diff --
Got it (especially now that I reread [the doc for the outer
method](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIWebViewDelegate_Protocol/#//apple_ref/occ/intfm/UIWebViewDelegate/webView:shouldStartLoadWithRequest:navigationType:))!
Thanks for explaining.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]