View Full Version : blocking ctrl+p

11-29-2005, 09:12 AM
hi everyone ,
i want to blocking print hotkey and i didn't find a way.
i tried
<body onbeforeprint="return false;" ...
<body onkeypress="[control codes]" ...
is there anyone to solve this...

and http://www.codingforums.com/showthread.php?t=224 in this thread there is some way to disabling print box but in xp it doesn't work


11-29-2005, 03:20 PM
How about...

Creating a CSS print sheet containing -

body {
display: none;

Whenever they print, it'll come out blank.

Or, a IE-only solution -

<body onBeforePrint="document.body.style.display='none'"; onAfterPrint="document.body.style.display='';">

11-29-2005, 05:22 PM
Remeber: If you put content on the web, people will be able to get it. Period. I don't want to start another thread about whether or not it is possible to hide this or that from the client. It isn't. You may be able to prevent them from printing your webpage easily, but you cannot prevent it altogether.

a) A client trying to print your content could use the print scrn button, and then paste into paint and print from there.

b) A client could copy your source code, and then go through and remove the bits of code that prevent printing, update the links, and print the file from his hard drive.

Your methods might stop a casual user, but aren't bulletproof.


11-29-2005, 07:35 PM
Ctrl-P is processed by the web browser and therefore doesn't get passed to the web page.

11-29-2005, 07:50 PM
But you can set up a special print CSS sheet with the display:none; property which will print a blank page..


12-01-2005, 05:30 PM
There is also screen captures as well not to mention browser cache, etc.

Don't put anything online that you can't afford to give away. It's that simple.