Thursday 3 November 2016

How to Disable Ctrl+U?

Sometimes to protect our website content from copy-paste & miss use of it or protect it from spam uses need some security. To check the code of webpage "Ctrl+U" is use.
Below is given method to stop this code by script.
Simply Add this code.

Here Script is stop "Ctrl+U" by key code.
Just put following code in Header section <head> tag.


<!--------- Put this code in "<head>" tag ------------->

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script>
document.onkeydown = function(e) {
        if (e.ctrlKey &&
            (e.keyCode === 67 ||
             e.keyCode === 86 ||
             e.keyCode === 85 ||
             e.keyCode === 117)) {
            return false;
        } else {
            return true;
        }
};
$(document).keypress("u",function(e) {
  if(e.ctrlKey)
  {
return false;
}
else
{
return true;
}
});
</script>


For more Interesting, Useful Article & codes visit IT New Code.

Ankit Shah PHP Expert

IT New Code suggest a solution for your problem related to coding, Specially .PHP, Wordpress, WooCommerce, Magento, HTML and CSS. Visit Our website for Information.

0 comments:

Post a Comment

 

Copyright @ 2016 IT New Code | Developing Code | Designing Code.

Designed by: Ankit Shah