Click here to Skip to main content
13,056,229 members (108,496 online)
Rate this:
Please Sign up or sign in to vote.
See more:
How to disabled printscreen key from keyboard
Posted 16-Mar-11 3:23am
Rate this: bad
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;} 
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.
Member 10863576 11-Jun-14 4:49am
bawale print disable nhi krna ...........print screen ko rokna hai....Question dhyan se phad
Rate this: bad
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.
SAKryukov 16-Mar-11 19:28pm
This is the best answer so far, my 5.
Espen Harlinn 17-Mar-11 19:41pm
Agree, my 5
Rate this: bad
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...

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170728.5 | Last Updated 16 Mar 2011
Copyright © CodeProject, 1999-2017
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