Click here to Skip to main content
14,971,754 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Is there any way of disabling right click on a website inside an Iframe( html control ) or a web browser control in Silverlight ... without modifying the source code( html , css & javascript ) of the website ? (it should not be by Adding a js to another websites source code)...???
Posted
Updated 30-Apr-16 22:36pm

Hi,

just Put Your Query On Google You Will Get Tons Of Solutions......
[^]
   
v3
Try this one

Just put it in your HTML code
XML
<script type="text/javascript">
function disableRightClick(btnClick) {
    if (navigator.appName == "Netscape" && btnClick.which == 3) { // check for netscape and right click
        alert("Right Click is disabled");
        return false;
    }
    else if (navigator.appName =="Microsoft Internet Explorer" && event.button == 2) { // for IE and Right Click
        alert("Right Click is disabled");
        return false;
    }
}
document.onmousedown = disableRightClick;
</script>
   
C#
function DisableRightClick(event)
{
//For mouse right click
if (event.button==2)
{
alert("Right Clicking not allowed!");
}
}
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900