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.

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.
RELATED POST:
Alert style validation using Javascript
Change text & background color while selecting text using CSS3
Change background image while page refresh using Javascript
Print or Save the Web page as .PDF Using Java Script
Choose state and city based on country using Jquery
Toggle Show/hide concept using java script
Make Bookmark / Favorites page using Java Script
No comments:
Post a Comment