how to disable to ctrl copy and paste on website using javascript

  Javascript

Email

how to disable to ctrl copy and paste on website using javascript

 

<script type = “text/JavaScript”
language = “JavaScript” >function killCopy(e) {return false}
function reEnable() {return true}
document.onselectstart = new Function(“return false”)
if (window.sidebar) {document.onmousedown = killCopy
document.onclick = reEnable}
window.onload = function () {
document.addEventListener(“contextmenu”, function (e) {
e.preventDefault();}, false);
document.addEventListener(“keydown”, function (e) {
if (e.ctrlKey && e.shiftKey && e.keyCode == 73) {
disabledEvent(e);}
if (e.ctrlKey && e.shiftKey && e.keyCode == 74) {
disabledEvent(e);}
if (e.keyCode == 83 && (navigator.platform.match(“Mac”) ? e.metaKey : e.ctrlKey)) {
disabledEvent(e);}
if (e.ctrlKey && e.keyCode == 85) {
disabledEvent(e);}
if (event.keyCode == 123) {
disabledEvent(e);}}, false);
function disabledEvent(e) {
if (e.stopPropagation) {e.stopPropagation();} else if (window.event) {
window.event.cancelBubble = true;}e.preventDefault();return false;}};
</script>

Spread the Code

Leave a Reply

avatar

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  Subscribe  
Notify of