简体   繁体   中英

Is there a way to hide the picture when the user press “print screen” button?

My site (php, javascript) presenting a picture to the user. I want to protect the picture, and make it as hard as possible to get. The user can't download it, but he can use the "print screen" button.

Is there a way to hide the picture when the user press "print screen" button?

No, because someone can simply view your website in a virtual machine and take a screenshot from the host operating system. Any answer that attempts to intercept keystrokes or clear the clipboard can easily be defeated by this approach and there's nothing you can do about it.

Not supported

This is not supported in web based solutions.

If you're using IE, You can try to clear the clipboard print screen by

<body onload=setInterval("window.clipboardData.setData('text','')",2) oncontextmenu="return false" onselectstart="return false">

but his is a bad approach.


If this is critical for you, consider wrap your web app with a native one that has low level hooks to cover that for you

The user can't download it

If the image is displaying on the screen then the browser has already downloaded it and the user can just browse to their cache and copy the file out. The best way to prevent image "piracy" is to use watermarking.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM