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

爱⌒轻易说出口 提交于 2019-12-09 13:13:16

问题


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


回答1:


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.



来源:https://stackoverflow.com/questions/5900285/ios-4-3-uiwebview-webkit-user-selectnone-problem

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!