Restrict Copy paste in application

Restrict Copy paste in application

  

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

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

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

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


Hi again,

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


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