Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mailto: link in UIWebView - Does Not work

Tags:

Is the areanything special you need in html or Callbacks in a UIWebView to handle anchor tags with an href, or is there something special about an anchor tag with a mailto link in the href?

like image 840
Sean McCully Avatar asked Apr 05 '10 17:04

Sean McCully


People also ask

Why is my mailto link not working in HTML?

If mailto links don't open for you the way they should, a quick look at the system or browser settings should do the job. In Windows, head to Settings -> Apps -> Default apps. Scroll down and pick “Choose default apps by protocol” from the menu. For 'Mailto', choose the client of your choice.


1 Answers

In your UIWebView's delegate, do:

- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {     if ([[[request URL] scheme] isEqual:@"mailto"]) {         [[UIApplication sharedApplication] openURL:[request URL]];         return NO;     }     return YES; } 
like image 145
cduhn Avatar answered Oct 04 '22 21:10

cduhn