Pages

Search Code Shode

Saturday, July 16, 2011

Disable Copy HTML Using Javascript

Thinking of a way to make it more difficult for people to copy the contents of your blog? Here's a neat little JavaScript that will disable Copy and Paste.


    <script type="text/javaScript">
    function disableselect(e){
    return false
    }
    function reEnable(){
    return true
    }
    document.onselectstart=new Function ("return false")
    if (window.sidebar){
    document.onmousedown=disableselect
    document.onclick=reEnable
    }
    </script>


Insert the code between the <head> and </head> tag.

However, there is no guarantee way to prevent your contents from being stolen.The JavaScript above can be easily bypassed by an experience internet user. E.g. If the browser's JavaScript is disabled, the code will not work.

اشتہارات