Hey Guys
I want to secure my images and other things and for that purpose I want to disable right click on my site. Is it possible to do so ? I came to know that I can do it using javascript. But i dont know how to do it. Please help me
Hey Guys
I want to secure my images and other things and for that purpose I want to disable right click on my site. Is it possible to do so ? I came to know that I can do it using javascript. But i dont know how to do it. Please help me
Its annoying for the visitors when you block right click but still I have a code for you.
Hope it helpsHTML Code:<SCRIPT TYPE="text/javascript"> <!-- //Disable right click script var message="Sorry, right-click has been disabled"; /////////////////////////////////// function clickIE() {if (document.all) {(message);return false;}} function clickNS(e) {if (document.layers||(document.getElementById&&!document.all)) { if (e.which==2||e.which==3) {(message);return false;}}} if (document.layers) {document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;} else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;} document.oncontextmenu=new Function("return false") // --> </SCRIPT>
donald (05-05-2009)
Guys keep in mind that right-click should not be disabled; think about it. If a user really wants an image on your website, all he or she has to do is press the "print screen" button, and the user can have access to any image that is displayed.
It is possible with Javascript, but only for very vew internet browsers like Internet Explorer. You should stay away from disabling right-click, because users may need it to perform a mandatory function in a certain situation, which may present security leaks and hazards for the users.
So you can disable right-click, but you cannot prevent users from getting images or copying information.
Bookmarks