Advertisement
Guest User

Untitled

a guest
Apr 15th, 2014
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. - (void)open:(CDVInvokedUrlCommand*)command
  2. {
  3. CDVPluginResult* pluginResult;
  4.  
  5. NSString* url = [command argumentAtIndex:0];
  6. NSString* target = [command argumentAtIndex:1 withDefault:kInAppBrowserTargetSelf];
  7. NSString* options = [command argumentAtIndex:2 withDefault:@"" andClass:[NSString class]];
  8.  
  9. self.callbackId = command.callbackId;
  10.  
  11. if (url != nil) {
  12. NSURL* baseUrl = [self.webView.request URL];
  13. NSURL* absoluteUrl = [[NSURL URLWithString:url relativeToURL:baseUrl] absoluteURL];
  14.  
  15. if ([self isSystemUrl:absoluteUrl]) {
  16. target = kInAppBrowserTargetSystem;
  17. }
  18.  
  19. if ([target isEqualToString:kInAppBrowserTargetSelf]) {
  20. [self openInCordovaWebView:absoluteUrl withOptions:options];
  21. } else if ([target isEqualToString:kInAppBrowserTargetSystem]) {
  22. [self openInSystem:absoluteUrl];
  23. } else { // _blank or anything else
  24. [self openInInAppBrowser:absoluteUrl withOptions:options];
  25. }
  26.  
  27. if (navigationType == UIWebViewNavigationTypeLinkClicked){
  28.  
  29. [[UIApplication sharedApplication] openURL:request.URL];
  30. return NO;
  31. }
  32.  
  33. return YES;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement