How to Disable Copy Paste (Browser)

You can't.

You can sort of try to block some vectors (like hacks to make right clicking more difficult, intercepting ctrl+c, making it difficult to select text)… But they will only sort of work, and it's impossible to block all vectors (edit -> copy? view source? wget? etc…).

If you are trying to protect your content from less technical users, these methods might be okay… But as the comments here suggest, they will frustrate more technical users.

If you have sensitive content that must be protected, you might want to consider embedding it in a Flash blob or a DRM'd PDF. These are still possible to reverse engineer, but it will take a slightly more intelligent attacker.


Instead of trying to control the users key commands(it is possible some browsers may detect this as malicious code) you can disable selection of text on your page. Although this will not avoid data being copied as stated in your comments.

<!-- Disable Copy and Paste-->
<script language='JavaScript1.2'>
function disableselect(e) {
    return false
}

function reEnable() {
    return true
}

document.onselectstart = new Function (&quot;return false&quot;)

if (window.sidebar) {
    document.onmousedown = disableselect
    document.onClick = reEnable
}
</script>

Place this in your

    <head> </head> 

tags and the user cannot select text on your page.

Found on http://myblog-log.blogspot.com/2007/06/disable-copy-and-paste.html