Portal of all Blogger widget, Airtel USSD Codes, Facebook Hack, Free Internet Tips, PC and Blogger Tricks

Breaking

Saturday 5 October 2013

How To Disable Mouse Right Click,Text Selection and Copying Text in Web Page



Disable Text Selection in Web-Page Or HTML Page
Follow Following Steps To Disable Right Click and Text Selection:

Demo: Try to Right click on This Page

 You May like: 

  • Edit Your HTML Code Of HTML Page
  • Find </head> tag.
  • Paste following Script Just before it.
Code:
  • Disable Right Mouse Click
<script type="text/javascript">
$(document).ready(function () {
    //Disable full page
    $("body").on("contextmenu",function(e){
        return false;
    });
 
    //Disable part of page
    $("#id").on("contextmenu",function(e){
        return false;
    });
});
</script>


  • To Disable Disable CUT/COPY/PASTE


<script type="text/javascript">
$(document).ready(function () {
    //Disable full page
    $('body').bind('cut copy paste', function (e) {
        e.preventDefault();
    });
 
    //Disable part of page
    $('#id').bind('cut copy paste', function (e) {
        e.preventDefault();
    });
});
</script>

  • Disable Mose Right Click + Copy And Paste
<script type="text/javascript">
$(document).ready(function () {
    //Disable cut copy paste
    $('body').bind('cut copy paste', function (e) {
        e.preventDefault();
    });
 
    //Disable mouse right click
    $("body").on("contextmenu",function(e){
        return false;
    });
});
</script>

I Hope You are now done.If you found any problem or error let Us Know...Don't Forget To Comment...

No comments:

Post a Comment

Notice: Don't add "backlink". Text with Link will automatically Removed.