Sunday 14 April 2013

How to Disable the Mouse Right Click on Blogger

Leave a Comment
How to Disable the Mouse Right Click on Blogger
If you're posting a piece of writing or a particular photograph onto your Blogspot blog, and you don't want people to copy it, you can use a Javascript code to prevent users from right-clicking. However, you should know that this will only prevent users who have Javascript turned on from right-clicking -- more advanced users will simply be able to bypass this protection. Unfortunately, besides the Javascript code, there isn't anyway to prevent someone from right-clicking.
  1. Go to Blogger.com and log in to your blog.

  2. Go to your "Blogger Dashboard," then click "Layout".

  3. Click "Add Gadget."

  4. Click "HTML/Javascript."

  5. Copy and paste the following code:

  6. <script language=JavaScript>
    <!--
    
    //Disable right mouse click Script
    //By Maximus (maximus@nsimail.com) w/ mods by DynamicDrive
    //For full source code, visit http://www.dynamicdrive.com
    
    var message="Function Disabled!";
    
    ///////////////////////////////////
    function clickIE4(){
    if (event.button==2){
    alert(message);
    return false;
    }
    }
    
    function clickNS4(e){
    if (document.layers||document.getElementById&&!document.all){
    if (e.which==2||e.which==3){
    alert(message);
    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("alert(message);return false")
    
    // -->
    </script>

  7. Click "Save." When you try and right click anywhere on your blog you will see a message that reads "Function Disabled."
You can change the words "Function Disabled" to anything you want by changing the words in the code.

0 comments :

Post a Comment

Related Posts Plugin for WordPress, Blogger...