Hi Team,
I have added the below script to disable the right click, it’s working in all browsers except Mozilla Firefox,
In Mozilla Firefox when you right click on the textbox field that is disabled, the right click menu is still appearing in Firefox, when the textbox field is disabled.
Can you please let me know the solution how to disable right click option in Firefox particularly for input text fields when it’s disabled?
<%-- below scripts are for disabling rigth click and --%>
<script type="text/javascript">
if (document.layers) {
//Capture the MouseDown event.
document.captureEvents(Event.MOUSEDOWN);
//Disable the OnMouseDown event handler.
document.onmousedown = function () {
return false;
};
}
else {
//Disable the OnMouseUp event handler.
document.onmouseup = function (e) {
if (e != null && e.type == "mouseup") {
//Check the Mouse Button which is clicked.
if (e.which == 2 || e.which == 3) {
//If the Button is middle or right then disable.
return false;
}
}
};
}
//Disable the Context Menu event.
document.oncontextmenu = function () {
return false;
}
</script>