Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS 4.3 UIWebView -webkit-user-select:none; Problem

I've been developing an iPad application that uses UIWebView to display some text and image data which is working great. However, I'm trying to stop the user selection that occurs when the user hold the screen for a couple of seconds. The usual methods seem to work fine on everything other than iOS 4.3.

I've tried a couple of different things such as:

body, html {
        -webkit-user-select:none;
        -webkit-tap-highlight-color: rgba(0,0,0,0);
        -webkit-touch-callout:none;
  }
* {
        -webkit-user-select:none;
        -webkit-tap-highlight-color: rgba(0,0,0,0);
        -webkit-touch-callout:none;
  }

And:

<body style='-webkit-user-select:none;'>

Nothing seems to work on iOS 4.3 - has anyone else had problems with this?

I've done a bit of digging and found something about the UIWebView Nitro Engine being different in iOS 4.3 - could this be causing the problem?

Thanks, AggroPanda

like image 502
AggroPanda Avatar asked Oct 11 '22 03:10

AggroPanda


1 Answers

I am having the same problem, but also a solution. Put this into your JavaScript code:

document.documentElement.style.webkitTouchCallout = "none";

It works in iOS 4.3. on an iPad. No idea why the CSS does not work in some iOS versions.

like image 108
Tim Avatar answered Jan 01 '23 09:01

Tim