Restrict Copy paste in application
704
Views
9
Comments
Question

Hi ,

As I am working on banking application,and should restrict copy paste in entire application. kindy suggest some solution. 

I have already used the below code,but its not working:

.content {
    background-color: #ffffff;
  -webkit-user-select: none;  / Chrome all / Safari all /
  -moz-user-select: none;     / Firefox all /
  -ms-user-select: none;      / IE 10+ /
  user-select: none;     / Likely future /  
 
}


Regards,

Sowndarya

2016-04-21 20-09-55
J.
 
MVP
Rank: #13

Hi,


even if you can fix it with css, people always can view the source or trace the network.

So I am not sure if you even can meet those requirements with a simple css

2020-04-15 12-37-36
Daniel Kuhlmann
 
MVP
Rank: #5

Add this javascript to your screen initialization:


 $(document).ready(function () {

    $('input').bind('copy paste', function (e) {

       e.preventDefault();

    });

  });


If you don't have/want to use jQuery you can do with native javascript:


document.querySelector('input').onpaste = function(e) {

    e.preventDefault();

}

document.querySelector(ínput').onCopy = function(e) {

    e.preventDefault();

}


Or on a specific input as extended property:

onpaste="return false"

onCopy="return false"

UserImage.jpg
sowndarya b
Rank: #78731

Daniël Kuhlmann wrote:

Add this javascript to your screen initialization:


 $(document).ready(function () {

    $('input').bind('copy paste', function (e) {

       e.preventDefault();

    });

  });


If you don't have/want to use jQuery you can do with native javascript:


document.querySelector('input').onpaste = function(e) {

    e.preventDefault();

}

document.querySelector(ínput').onCopy = function(e) {

    e.preventDefault();

}


Or on a specific input as extended property:

onpaste="return false"

onCopy="return false"


Hi Daniel,

I tried adding extended property,but its not working. Also used the JavaScript in Oninitialize of the module and it thows an error of null.



document.querySelector('Input_UsernameVal').onpaste = function(e) {

    e.preventDefault();

}

document.querySelector('Input_UsernameVal').onCopy = function(e) {

    e.preventDefault();

}

Can you tell me what input should i give,the name of input box or ID.


Regards,

Sowndarya


UserImage.jpg
sowndarya b
Rank: #78731

Hi Daniel,

I tried adding extended property,but its not working. Also used the JavaScript in Oninitialize of the module and it thows an error of null.



document.querySelector('Input_UsernameVal').onpaste = function(e) {

    e.preventDefault();

}

document.querySelector('Input_UsernameVal').onCopy = function(e) {

    e.preventDefault();

}

Can you tell me what input should i give,the name of input box or ID.


Regards,

Sowndarya

2020-04-15 12-37-36
Daniel Kuhlmann
 
MVP
Rank: #5

Hi again,

I did a quick check but the extended properties implementation does work for me:


2022-04-12 14-51-40
Paulo Chaves
Rank: #14891

Traditional Web application. Worked!!! Thanks!!!

2020-04-15 12-37-36
Daniel Kuhlmann
 
MVP
Rank: #5

Using JQuery to have the paste functionality blocked for all inputs also works for me:

2020-12-07 17-12-41
J Grou
Rank: #2368

Hi Daniël Kuhlmann,

I am also trying to do the same in the extended properties of the input and its not working, I am using OS11 Mobile (11.6.2) and I am testing it using OS Now. Could it be because of the emulator?


Update: Also tried the JS and it didnt worked as well. I havent found any more solutions other than those two so i dont know where to go from here...

2018-09-07 10-04-42
Suhas Jamdade
Rank: #227


Hello sowndarya b,


try with this css pointer-events: none;