Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
Node is saved as draft in My Content >> Draft
  • Disable Right Click on images

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 46
    Comment on it

    To disable right click on images we need to write a javascript code


    First we need to set the attribute of image control to false. Then we will write a function for displaying error message


       Ex:
             <asp:Image ID="img1" runat="server" ImageUrl=""../ImgLoc/1.png"" oncontextmenu="return false;" />
            <img alt="MyImage" src="../ImgLoc/2.png" oncontextmenu="return false;"/> 
    
         <html>
        <head>
        ...
        </head>
        <body oncontextmenu="return false;" >
        ...
        </body>
        </html> 
    


    We will show alert message on right click . For that we have created the function for doing this.


     <script type="text/javascript"> 
    function disableRightClick() 
    { 
    alert("Sorry, right click is not allowed !!"); 
    return false; 
    } 
    </script> 
    <body oncontextmenu=" return disableRightClick();">
    ... 
    </body> 
    
    .net

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: