Github user agrieve commented on a diff in the pull request:
https://github.com/apache/cordova-ios/pull/116#discussion_r19541663
--- Diff: CordovaLib/Classes/CDVViewController.m ---
@@ -749,24 +767,77 @@ - (BOOL)webView:(UIWebView*)theWebView
shouldStartLoadWithRequest:(NSURLRequest*
return YES;
}
- /*
- * Handle all other types of urls (tel:, sms:), and requests to load a
url in the main webview.
- */
- else {
- if ([self.whitelist schemeIsAllowed:[url scheme]]) {
- return [self.whitelist URLIsAllowed:url];
- } else {
- if ([[UIApplication sharedApplication] canOpenURL:url]) {
- [[UIApplication sharedApplication] openURL:url];
- } else { // handle any custom schemes to plugins
- [[NSNotificationCenter defaultCenter]
postNotification:[NSNotification
notificationWithName:CDVPluginHandleOpenURLNotification object:url]];
+ return NO;
+}
+
+- (BOOL)shouldAllowRequestForURL:(NSURL *)url
+{
+ BOOL anyPluginsResponded = NO;
+ BOOL shouldAllowRequest = NO;
+ for (NSString* pluginName in pluginObjects) {
+ CDVPlugin* plugin = [pluginObjects objectForKey:pluginName];
+ SEL selector = NSSelectorFromString(@"shouldAllowRequestForURL:");
--- End diff --
You should document these new selectors in CDVPlugin.h. When doing so, make
note that shouldAllowRequestForURL doesn't work with websocket, or at all for
WKWebView
---
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]