Disable right click on Pdf using asp.net

Posted by Pradeepmanne under ASP.NET on 10/8/2013 | Points: 10 | Views : 9892 | Status : [Member] | Replies : 2
hi,

Is it possible to open pdf file in asp.net web page without print,save and save as etc options
or how to Disable right click on Pdf using asp.net




Responses

Posted by: Brahmam on: 10/9/2013 [Member] Starter | Points: 25

Up
0
Down
<script language="JavaScript" type="text/javascript">
//Message to display whenever right click on website
var message = "Sorry, Right Click have been disabled.";
function click(e) {
if (document.all) {
if (event.button == 2 || event.button == 3) {
alert(message);
return false;
}
}
else {
if (e.button == 2 || e.button == 3) {
e.preventDefault();
e.stopPropagation();
alert(message);
return false;
}
}
}
if (document.all) {
document.onmousedown = click;
}
else {
document.onclick = click;
}
</script>

brahmam

Pradeepmanne, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Samirbhogayta on: 10/17/2013 [Member] Starter | Points: 25

Up
0
Down
hi..

//To disablerightclick in the application

document.onmousedown = disableclick;
status ="Right click option is not allowed";

function disableclick(e)
{
if (event.button == 2)
{
alert(status);
return false;
}
}

SAMIR
Sr. Software Engineer

Pradeepmanne, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response