Disable right click and protect your content from coping using Java script | 2my4edge

30 July 2013

Disable right click and protect your content from coping using Java script

Disable right click button in mouse using javascript, this concept is mostly used for protect your content from coping your copy right content and all, most of the hacker trying to copy your content and try to reveal your secret of your web page, that’s why this script is using for protect. If we are using this right click disable click, the hacker cannot right click on the web page. So he cannot copy or cannot make inspect element and does not able to select the text.
disable right click protect from copy using javascript

DOWNLOAD                LIVE DEMO
and I don’t think this is fully secured to make complete protection but it make some. I know some of the trick to make inspect the element and can view source of the page. that is possible.  First try this coding for disable right click.

SCRIPT
<script type="text/javascript">
    function clickIE4(){
    if (event.button==2){
    return false;
    }
    }
    function clickNS4(e){
    if (document.layers||document.getElementById&&!document.all){
    if (e.which==2||e.which==3){
    return false;
    }
    }
    }
    if (document.layers){
    document.captureEvents(Event.MOUSEDOWN);
    document.onmousedown=clickNS4;
    }
    else if (document.all&&!document.getElementById){
    document.onmousedown=clickIE4;
    }
    document.oncontextmenu=new Function("return false")
    function disableselect(e){
    return false
    }
    function reEnable(){
    return true
    }
    //if IE4+
    document.onselectstart=new Function ("return false")
    //if NS6
    if (window.sidebar){
    document.onmousedown=disableselect
    document.onclick=reEnable
    }
</script>

( GOOGLE CHROME & MOZILA FIREFOX ) If you want to inspect the element just use the shortcut key for that is CTRL+SHIFT+I is for inspect the element.

and if your want to see the view source of the page is also possible by using the shortcut key of CTRL+U

and in an Internet Explorer use F12 for developer tool and click on the page --> view source.

and do not think everyone know this kind of trick if the people or visitor come and view you page just see the page and try to right click and if it not works the right click button, man goes away. That’s it.

and I’ll show to disable the javascript on next post. That is also possible and very simple.

No comments:

Post a Comment

^