Rss Feed Like Us on facebook Google Plus

August 9, 2013

Disable Ctrl+C ,Ctrl+V ,Ctrl+A in a web page : Javascript

Question How to disable Ctrl+C , Ctrl+V , Ctrl+A in any web page by using javascript.

More..
Disable Button after clicking on it.

Solution:
just copy and paste below script in <head> section


<script type="text/javascript">
        function Disable_Control_C() {
            var keystroke = String.fromCharCode(event.keyCode).toLowerCase();
 
            if (event.ctrlKey && (keystroke == 'c' || keystroke == 'v' || keystroke == 'a')) {
                alert("This function not allowed");
                event.returnValue = false; // disable Ctrl+C
            }
        }
    </script>

and call the function in html body

<body onkeydown="javascript:Disable_Control_C()">
Hello World!
</body>
</html>

© 2011-2016 Techimpulsion All Rights Reserved.


The content is copyrighted to Tech Impulsion and may not be reproduced on other websites.