Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions src/ios/CDVWKInAppBrowser.m
Original file line number Diff line number Diff line change
Expand Up @@ -303,13 +303,22 @@ - (void)openInCordovaWebView:(NSURL*)url withOptions:(NSString*)options
[self.webViewEngine loadRequest:request];
}

- (void)openInSystem:(NSURL*)url
- (void)openInSystem:(NSURL *)url
{
[[UIApplication sharedApplication] openURL:url options:@{} completionHandler:^(BOOL success) {
if (!success) {
[[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:CDVPluginHandleOpenURLNotification object:url]];
}
}];
// Check if the URL can be opened
if ([[UIApplication sharedApplication] canOpenURL:url]) {

// Use the new method to open the URL with completion handler
[[UIApplication sharedApplication] openURL:url options:@{} completionHandler:^(BOOL success) {
if (!success) {
// Post a notification if the URL could not be opened
[[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:CDVPluginHandleOpenURLNotification object:url]];
}
}];
} else {
// Post a notification if the URL can't be opened
[[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:CDVPluginHandleOpenURLNotification object:url]];
}
}

- (void)loadAfterBeforeload:(CDVInvokedUrlCommand*)command
Expand Down