I am trying to disable text selection and copy paste in phonegap applicaion by using following code.
CSS
-webkit-user-select:none;
JavaScript
$('body').on('cut copy paste',function(e){e.preventDefault();});
It works on all OS platforms including adroid 4.4+ but having issues on 4.1 and 4.2. Please Help.
Both doesn't support android 4.1.2 and 4.2.1.
[Tested on Micromax canvas 4 and samsung galaxy s2]
You can use jquery for this: $('body'). bind('copy paste',function(e) { e. preventDefault(); return false; });
You can use the user-select property to disable text selection of an element. In web browsers, if you double-click on some text it will be selected/highlighted. This property can be used to prevent this.
To disable the copy and paste function in PDFs, you need to prevent the ability to select text with the cursor. If a user can't select the text, then they can't right-click and copy with the mouse or use Ctrl-C as a keyboard command.
you can use css to do that
*
{
-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;
}
found here Disable Copy and Paste in Phonegap
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With