You can also use the webkit javascript bridge https://github.com/marcuswestin/WebViewJavascriptBridge
This allows you to send messages from javascript to xcode. I use this to close the webview from the html page:
self.bridge = [WebViewJavascriptBridge bridgeForWebView:self.webView handler:^(id data, WVJBResponseCallback responseCallback) {
NSLog(@"Received message from javascript: %@", data);
if ([data isEqual:@"closewin!"])
[self dismissModal];
}];
but you could also use this to jump to safari or anything you want