UIWebView - How to disable action sheets (UIActionSheet)?

I would like to know how you can disable UIActionSheets, in particular, action sheets displayed after clicking and holding hyperlinks in UIWebView. It seems that they are included by default in UIWebViews containing the link address of the corresponding link in the warning header. They are also included in Safari.

(How) is it possible to disable all action tables of this type in UIWebView?

Thanks in advance!

+5
source share
5 answers

I myself found this solution. Add this to your CSS:

body {
  -webkit-touch-callout: none;
}

To be clear, this disables the action bar that appears when you hold the hyperlink.

+7

JavaScript, :

document.documentElement.style.webkitTouchCallout = "none";
+3
 - (void)webViewDidFinishLoad:(UIWebView *)webView
 {
    [webView stringByEvaluatingJavaScriptFromString:@"document.body.style.webkitTouchCallout='none'; document.body.style.KhtmlUserSelect='none'"];
 }
+2

The dataDetectorTypes property may be what you are looking for. If you want to disable this action list, just paste the code:

webView.dataDetectorTypes = UIDataDetectorTypeNone;
0
source

You can override presentViewController in a UINavigationController and not do anything like that.

@implementation CDVInAppBrowserNavigationController : UINavigationController

- (void)presentViewController:(UIViewController *)viewControllerToPresent animated: (BOOL)flag completion:(void (^ __nullable)(void))completion NS_AVAILABLE_IOS(5_0){
    //Do nothing.
}

@end
0
source

All Articles