jQuery to disable or prevent right click on asp.net web page to protect HTML Source or images from being copied

  ASP.NET Projects

First Method:-

 <html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
        <title>Disable right click on web page using jQuery</title>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
    <script type="text/javascript">
     $(function () {
            $(this).on("contextmenu", function () {
                return false;
            });
        });
</script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        This is dummy text<br />
        This is dummy text<br />
        This is dummy text<br />
        This is dummy text<br />
        This is dummy text<br />
    </div>
    </form>
</body>
</html>

Second Method:-

 <html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Disable right click on web page using jQuery</title>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
   <script type="text/javascript">
        $(function () {
            $(this).on("contextmenu", function (event) {
                event.preventDefault();
            });
        }); 
</script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        This is dummy text<br />
        This is dummy text<br />
        This is dummy text<br />
        This is dummy text<br />
        This is dummy text<br />
    </div>
    </form>
</body>
</html>

 

3,217 thoughts on - jQuery to disable or prevent right click on asp.net web page to protect HTML Source or images from being copied

LEAVE A COMMENT