Reputation: 2557
is there a way to trigger the native ios share function from a ios webview?
On Android I'm doing this by using JavaScript Interface and call the share intent. I am wondering can I do the same for my ios app.
Upvotes: 3
Views: 1047
Reputation: 11039
Check UIWebViewDelegate
method named
-webView:shouldStartLoadWithRequest:navigationType:
. e.g.
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
if ([[request.URL absoluteString] isEqualToString:@"share_url"]) {
// Open native share dialog
return NO;
}
return YES;
}
Upvotes: 1