I am developing one web application using asp.net(vb.net), in this application, I have to display excel,word,powerpoint and pdf files in my browser but restrict the user to save that file and also disable cut,copy,paste,mouse right click and print options.
Please help me out ASAP from this problem.
Thanks
Disable Cut, Copy and Paste in Excel, Word and Powerpoint displaying in browser.
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.
Bechir BejaouiRank #144 · 15.9K reputationPosted Jun 8, 2008, 6:24 AM EDT
//*Written by Ravi Shankar Bhatia
//*The above information may not be removed ..For help please email: [email protected]
//********************************/
PopUpURL = "The right click options are disabled for this window";
isIE=document.all;
isNN=!document.all&&document.getElementById;
isN4=document.layers;
if (isIE||isNN)
{
document.oncontextmenu=checkV;
}
else
{
document.captureEvents(Event.MOUSEDOWN || Event.MOUSEUP);
document.onmousedown=checkV;
}
function checkV(e)
{
if (isN4)
{
if (e.which==2||e.which==3)
{
dPUW=alert(PopUpURL);
return false;
}
}
else
{
dPUW=alert(PopUpURL);
return false;
}
}
This is an example for disabling right click.
Right click on this page to test it