In my application i have a div where we are displaying a pop up with pdf file by using iframe i need to disbale the right click on pdf file or i should not allow user to save or print the file how can i do this
I tried the below code but its not working
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript">
function disableContextMenu() {
if (document.layers) {
//Capture the MouseDown event.
document.captureEvents(Event.MOUSEDOWN);
//Disable the OnMouseDown event handler.
$(document).mousedown(function () {
return false;
});
} else {
//Disable the OnMouseUp event handler.
$(document).mouseup(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).contextmenu(function () {
return false;
});
}
</script>
<html>
<body>
<div><iframe id="fraDisabled" width="528" height="473" src="NewFolder1/jpg2pdf.pdf" onload="disableContextMenu();" onMyLoad="disableContextMenu();"></iframe></div>
</body>
</html>