Thursday 2 April 2015

Disable right click menu in html page using jquery


Disable Right click from webpages
<script type="text/javascript" language="javascript">
        $(function() {
            $(this).bind("contextmenu", function(e) {
                e.preventDefault();
            });
        }); 
    </script>
Disable Right click to Images only.

document.addEventListener("contextmenu", function(e){
    if (e.target.nodeName === "IMG") {
        e.preventDefault();
  alert('Right Click Not Allowed !!!');
    }
  }, false);

No comments:

Post a Comment