function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Mohammed Zabi 1Mohammed Zabi 1 

disable Ctrl+x and ctrl+p and Print Screen in visualforce page

Hi,
I need to Privent the Ctrl+x and Ctrl+p and Print Screen button in Visualforce page for IE browser using javascript please help on this
Thanks,
 Zabi
 
Best Answer chosen by Sonam (Salesforce Developers) 
Zabi MohammedZabi Mohammed
Hi,
I was got solushan for Ctrl+x,Ctrl+v,ctrl+a,ctrl+p 


<script type="text/javascript"> $(document).ready(function() { var ctrlDown = false; var ctrlKey = 17, vKey = 86, cKey = 67,xKey = 88, aKey = 65, LarrowKey = 37, RarrowKey = 39, ShiftKey = 16; $(document).keydown(function(e) { if (e.keyCode == ctrlKey || e.keyCode == ShiftKey) ctrlDown = true; }).keyup(function(e) { if (e.keyCode == ctrlKey || e.keyCode == ShiftKey) ctrlDown = false; }); $(".no-copy-paste").keydown(function(e) { if (ctrlDown && (e.keyCode == vKey || e.keyCode == cKey || e.keyCode == xKey || e.keyCode == aKey || e.keyCode == LarrowKey || e.keyCode == RarrowKey)) return false; }); }); </script>
 

All Answers

SonamSonam (Salesforce Developers) 
Did you get a chance to check the following  link:http://blog.biswajeetsamal.com/2014/08/how-to-disable-right-click-on.html
 
Mohammed Zabi 1Mohammed Zabi 1
Hi Sonam,

  Thanks for your replay but i need to disable Print Screen i was disabled Ctrl+x but i am not abale to disable Print Screen button and a Ctrl+p will you please help on this..

Thanks,
  Zabi 
Zabi MohammedZabi Mohammed
Hi,
I was got solushan for Ctrl+x,Ctrl+v,ctrl+a,ctrl+p 


<script type="text/javascript"> $(document).ready(function() { var ctrlDown = false; var ctrlKey = 17, vKey = 86, cKey = 67,xKey = 88, aKey = 65, LarrowKey = 37, RarrowKey = 39, ShiftKey = 16; $(document).keydown(function(e) { if (e.keyCode == ctrlKey || e.keyCode == ShiftKey) ctrlDown = true; }).keyup(function(e) { if (e.keyCode == ctrlKey || e.keyCode == ShiftKey) ctrlDown = false; }); $(".no-copy-paste").keydown(function(e) { if (ctrlDown && (e.keyCode == vKey || e.keyCode == cKey || e.keyCode == xKey || e.keyCode == aKey || e.keyCode == LarrowKey || e.keyCode == RarrowKey)) return false; }); }); </script>
 
This was selected as the best answer