5

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

AggroPanda
  • 235
  • 4
  • 10
  • 1
    I am having exactly the same problem, AggroPanda. Were you able to find a solution to this in the mean time? – Engin Kurutepe May 13 '11 at 17:01
  • 2
    I had the same issue. It looks like this might be an OS specific issue as it only affects some versions of iOS. If you run your web view on an older/newer version of iOS you'll find you don't have the issue. – Jamie Chapman Jun 01 '11 at 17:48
  • Excelent thing: `-webkit-tap-highlight-color: rgba(0,0,0,0);` – Dmitry Oct 30 '12 at 05:43

1 Answers1

4

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.

Tim
  • 13,228
  • 36
  • 108
  • 159