I would like to deactivate the right click in my app that offers the option to install the app on the desktop. How do I do such thing?
Asked
Active
Viewed 141 times
2 Answers
4
Right click on the project in Visual Studio and select properties. There is a check-box "enable running out of browser" option there.

KeithMahoney
- 3,323
- 19
- 10
2
Here's a hackish way to do it for older versions of SilverLight from a silverlight forum:
<div id="silverlightObjDiv">
<!-- silverlight object here -->
</div>
<script>
document.getElementById('silverlightObjDiv').oncontextmenu = disableRightClick;
function disableRightClick(e) {
if (!e) e = window.event;
if (e.preventDefault) {
e.preventDefault();
} else {
e.returnValue = false;
}
}
</script>
If you are using a recent version, you can disable this behavior from the properties of your project.

Michael Goldshteyn
- 71,784
- 24
- 131
- 181