Micro Niche Builder
Closed Thread
Results 1 to 4 of 4

Thread: Disable Right Click

  1. #1

    Default Disable Right Click

    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


  2. SEO Software

  3. #2

    Default

    Its annoying for the visitors when you block right click but still I have a code for you.

    HTML 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> 
    Hope it helps

  4. The Following User Says Thank You to nikon For This Useful Post:

    donald (05-05-2009)

  5. #3

    Default

    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.

  6. #4

    Smile

    Quote Originally Posted by nikon View Post
    Its annoying for the visitors when you block right click but still I have a code for you.

    HTML 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> 
    Hope it helps
    thanks nikon....
    wonderful posting that helps me also....
    thanks once again....

Closed Thread

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts