Skip to content Skip to sidebar Skip to footer

How To Capture Printscreen Event In Javascript?

I'm trying to write a web application which has some sensitive content in it. I have already prevented copy-and-paste. How do I detect when someone presses the printscreen key, so

Solution 1:

The short answer is, you can't reliably detect or interfere with the print screen function. This is not a browser function but a function of the user's system, so for most cases the event fires outside of the environment you're trying to detect it in. Neither html, css or javascript can listen for the event, or prevent its default action in a way that is dependable. You should re-think your strategy for protecting your content, and accept the reality that no matter what you do, there will always be way for people to "steal" it.

EDIT:

I was thinking, you could write a java applet that detected the print screen event firing as java may have access to system events. But I haven't bothered looking into how you could do this because the function depends on two things - the user having java installed and enabled in their browser, and the java applet having the security permissions granted to it to go snooping the system events.

Just out of interest: https://stackoverflow.com/a/29965963/4933137

Post a Comment for "How To Capture Printscreen Event In Javascript?"