17

Possible Duplicate:
How do i prevent from printscreen of my webpage?

I want to prevent users from taking screen shots of a web-page. What should be the code I have to place in that .html file?

What should be the code to prevent button press like print screen? Because many website prevents users from pressing any keys.

Community
  • 1
  • 1
Debadyuti Maiti
  • 1,009
  • 4
  • 17
  • 29
  • 1
    Actually I hear there is a way to make a "watermark" to an image that renders to black when you screenshot it, if you make a div that covers your entire page (width:100%; height:100%) and places this "watermark" with a transparent background and it will no longer be possible to screenshot your website. Of course, anyone with firebug or inspect object on chrome could simply delete that div and take screenshots as normal. I guess you could recreate that div in a timer and obfuscate the code. But in all there is no way to make this 100% impossible. – Hoffmann Sep 14 '12 at 17:49
  • 1
    @Hoffmann How about when activating some other application window on the screen and then hitting `Print screen`? – Teemu Sep 14 '12 at 17:51
  • 7
    @Hoffmann if you can see if on the screen you can capture it. period. – Ben D Sep 14 '12 at 17:51
  • As I said I heared there is a way to make this, I don't know how to do it myself and a quick google search yields nothing. Also @Ben D, HDCP prevents screenshots from DRMed blu-rays. You can bypass it today but for some time it was simply impossible – Hoffmann Sep 14 '12 at 17:53
  • @Hoffmann if something is being output by your video card it can be captured. As I mentioned in my answer, there are ways of making it more difficult, but never impossible... and over the web you can't even really make it that difficult. The same goes for audio... it has to be output, so it can be read – Ben D Sep 14 '12 at 18:31
  • @Hoffmann and on the issue of HDCP, I believe this was a hardware licensing agreement (data wouldn't be transmitted at all to non HDCP devices), though it succeeded in making it quite hard to capture data because they dictated the rules of your hardware. – Ben D Sep 14 '12 at 20:00
  • 1
    You also can't stop them taking a picture of the screen with their mobile phone, or copying the information off by hand onto a piece of paper with a pencil. – Donal Fellows Sep 15 '12 at 08:43
  • 1
    Simple. Don't publish any content worth stealing. Most of the web uses this technique, IMHO. – FastAl Sep 14 '12 at 18:02
  • You could do some really fast random flickering pixels where it goes too fast for your eye to see, but when captured it would see a lot of noise – Joe Love May 05 '21 at 17:34

4 Answers4

18

Screenshots are not controlled by the web browser, they are controlled by software running on the user's operating system and cannot be remotely controlled by a web server.

JSK NS
  • 3,226
  • 2
  • 23
  • 40
  • 3
    Somehow Netflix’s browser-based version has done it where captures just give a black image with no content. Possibly, though, this is something built-in to the player plug-in so I guess it would depend on your content and whether you’re trying to block the whole page or just images or other bits. – DonP Jul 16 '21 at 21:34
12

It is possible. Try this css feature.

html {
    display: none;  /* hide whole page - the only true way to prevent screenshots */
}
Greg
  • 20,248
  • 16
  • 79
  • 106
Nelson
  • 46,753
  • 8
  • 64
  • 79
1

You cannot block the print screen button or the snipping tool in Windows 7 or the Grab application included with Mac OS or...

DanielBlazquez
  • 1,007
  • 1
  • 12
  • 21
1

Nelson's right. There's a lot you can do to make it harder (javascript to capture the prtsc key press and return false, flicker different quadrants of the screen at intervals so that it's too fast for human eyes to really tell but so that the whole screen never shows at once, etc) but fundamentally anyone who's even vaguely tech-savy can bypass this in about 5 seconds. Also, a google search should have answered this for you in way less time than it took to ask.

Ben D
  • 13,680
  • 3
  • 44
  • 59