Javascript 有哪些方法可以防止用户对网页进行截图?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12429439/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What are the ways to prevent users to take screenshot of a webpage?
提问by Debadyuti Maiti
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?
我想阻止用户截取网页的屏幕截图。我必须在该 .html 文件中放置的代码是什么?
What should be the code to prevent button press like print screen? Because many website prevents users from pressing any keys.
防止像打印屏幕那样按下按钮的代码应该是什么?因为许多网站阻止用户按任何键。
回答by Nelson
It is possible. Try this css3 feature.
有可能的。试试这个 css3 功能。
@media print {
html, body {
display: none; /* hide whole page */
}
}
回答by JSK NS
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.
屏幕截图不受 Web 浏览器的控制,它们由运行在用户操作系统上的软件控制,不能由 Web 服务器远程控制。
回答by DanielBlazquez
You cannot block the print screen button or the snipping tool in Windows 7 or the Grab application included with Mac OS or...
您无法阻止 Windows 7 中的打印屏幕按钮或截图工具或 Mac OS 附带的 Grab 应用程序或...
回答by Ben D
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.
纳尔逊是对的。你可以做很多事情来让它变得更难(javascript来捕获prtsc按键并返回false,每隔一段时间闪烁屏幕的不同象限,这样人眼真的分辨不出来,但整个屏幕永远不会显示在一次等)但基本上任何精通技术的人都可以在大约 5 秒内绕过它。此外,谷歌搜索应该以比提问更短的时间为您回答这个问题。
回答by Debadyuti Maiti
using Javascript is an option only to prevent key pressing.
使用 Javascript 只是为了防止按键。