Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Javascript Linux
How to disabled printscreen key from keyboard
Posted 16-Mar-11 4:23am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Since you tagged it Javascript, I assume this about not-printing web pages, yes?
 
If so, then open your HTML file, and just before the closing HEAD tag:
  <style type="text/css" media="print">
     body {display:none;} 
  </style>
</HEAD>
It doesn't stop them printing, but all they get is a blank page.
Note: They can still copy an image to the clipboard and print that from a paint program, but AFAIK there is no way to stop that from a web app.
  Permalink  
Comments
Member 10863576 at 11-Jun-14 4:49am
   
bawale print disable nhi krna ...........print screen ko rokna hai....Question dhyan se phad
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Many times we pick a solution and stick out gun to it. Whatever your requirement or situation might be, I would not try to do it for the following reasons.
 
1. Once you pages are in the public domain, it won't be that hard to break it.
2. You are relying on JavaScript to stop Print Screen key press. How would you prevent copy/paste, saving the page, screen grafting etc which then can be printed?
3. What if I disable JavaScript on my browser, you code won't have much functionality.
 
If you trying to prevent printing the page, you may as well revisit why you want to do it, and accept the inevitably and just leave it alone. At very best, you can add disclaimer to your page.
  Permalink  
Comments
SAKryukov at 16-Mar-11 19:28pm
   
This is the best answer so far, my 5.
--SA
Espen Harlinn at 17-Mar-11 19:41pm
   
Agree, my 5
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

Just in case your problem is not only regarding the web and you would like to kill that key for the computer in which you have your software, then think on a "windows hook" per linux...
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 400
1 Sergey Alexandrovich Kryukov 329
2 Afzaal Ahmad Zeeshan 264
3 BillWoodruff 245
4 CPallini 195
0 OriginalGriff 5,560
1 DamithSL 4,476
2 Maciej Los 3,942
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,175


Advertise | Privacy | Mobile
Web01 | 2.8.141216.1 | Last Updated 16 Mar 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100