使用JS禁用混合应用程序中的文本选择和复制粘贴

Hum*_*ird 6 copy paste textselection cordova

我试图通过使用以下代码禁用文本选择和复制粘贴在phonegap应用程序中.

CSS

-webkit-user-select:none;
Run Code Online (Sandbox Code Playgroud)

JavaScript的

$('body').on('cut copy paste',function(e){e.preventDefault();});
Run Code Online (Sandbox Code Playgroud)

它适用于所有操作系统平台,包括adroid 4.4+,但在4.1和4.2上存在问题.请帮忙.

两者都不支持android 4.1.2和4.2.1.

[测试Micromax帆布4和三星galaxy s2]

Ata*_*CSE 16

你可以使用css来做到这一点

*
{
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}

input
{
-webkit-user-select: auto !important;
-khtml-user-select: auto !important;
-moz-user-select: auto !important;
-ms-user-select: auto !important;
user-select: auto !important;
}
Run Code Online (Sandbox Code Playgroud)

在此处找到禁用复制并粘贴在Phonegap中