简体   繁体   中英

UIWebView tel: phone link delegate not called on iPad (but it works on iPhone)

My UIWebView shows a web page which contains the URL tel:+123456789

<a href="tel:+123456789">Phone link</a>

When I click on this link on iPhone, my UIWebViewDelegate gets called correctly.

- (BOOL)webView:(UIWebView *)webView
        shouldStartLoadWithRequest:(NSURLRequest *)request
        navigationType:(UIWebViewNavigationType)navigationType

When I click on this link on iPad, my UIWebViewDelegate does not get called at all. Instead a UIActionSheet appears automagically with the options 'Add to Contacts', 'Copy' and 'Cancel'.

Is there a way to catch "tel:" HTML links from a UIWebView on a device that does not have phone capabilities eg an iPad.

This behaviour is the same for the simulator:

  • iPhone simulator: delegate is called
  • iPad simulator: delegate is not called

Have you tried a simple:

if ( UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad )
{
     return YES; /* Device is iPad */
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM