Opening clicked links in iOS Safari

This feature is applicable to iOS platforms only.

You can intercept user clicks on links to optionally allow launching of links in Safari.

To do this, you can implement the didClickLink() function in your DocumentViewController (see KGPagedDocControlDelegate). You can choose which URLs are handled by the framework and which to handle yourself e.g. by opening in Safari:

- (BOOL)document:(KGPagedDocControl *)doc didClickLink:(NSURL *)url {
  NSString *scheme = [url scheme];
  if ([scheme caseInsensitiveCompare:@"http"]!=NSOrderedSame &&
      [scheme caseInsensitiveCompare:@"https"]!=NSOrderedSame) {
    // internal/local file, so allowing the framework to handle as usual
    return NO;
  // we have a link with an http/https scheme
  // launch the link using the system handler - mobile safari
  [[UIApplication sharedApplication] openURL: url];
  // return that we have handle the click, so the framework doesn't do anything further
  return YES;
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request


Powered by Zendesk