Kno*_*ing 52 html javascript webpage-screenshot
我目前正在做一个项目,我需要阻止用户拍摄任何网页的快照,为此他可以使用任何普通键盘中的"Print Scrn"/"Printscreen"键.
我一直试图找到它的解决方案,但是徒劳无功.如果可能的话,我需要考虑Firefox浏览器的" Screengrab "插件,也可以将其停止.
非常感谢任何帮助,我正在为我的项目使用PHP(作为服务器端语言)和jQuery.
小智 46
我讨厌"这不可能"的句子.以下所有解决方案可以帮助您:
1-您可以从Haluk获取解决方案:
<script type="text/javascript"> $(document).ready(function() {
$(window).keyup(function(e){
if(e.keyCode == 44){
$("body").hide();
}
}); });
</script>
Run Code Online (Sandbox Code Playgroud)
但是,你隐藏了身体,但已经"打印"到剪贴板.你可以触发另一个将一些文本复制到剪贴板的事件,正如你在这个答案中看到的"编辑截至2016年" 点击按钮复制到剪贴板使用jQuery,它是这样的:
function copyToClipboard() {
// Create a "hidden" input
var aux = document.createElement("input");
// Assign it the value of the specified element
aux.setAttribute("value", "Você não pode mais dar printscreen. Isto faz parte da nova medida de segurança do sistema.");
// Append it to the body
document.body.appendChild(aux);
// Highlight its content
aux.select();
// Copy the highlighted text
document.execCommand("copy");
// Remove it from the body
document.body.removeChild(aux);
alert("Print screen desabilitado.");
}
$(window).keyup(function(e){
if(e.keyCode == 44){
copyToClipboard();
}
});
Run Code Online (Sandbox Code Playgroud)
这将阻止您的部分问题.如果用户专注于此窗口之外的另一个对象,他将能够截取屏幕截图.**但是还有另一个解决方案,当窗口没有聚焦时,只需禁用孔体.完全解决方案,来自您亲爱的brazillian朋友:
function copyToClipboard() {
// Create a "hidden" input
var aux = document.createElement("input");
// Assign it the value of the specified element
aux.setAttribute("value", "Você não pode mais dar printscreen. Isto faz parte da nova medida de segurança do sistema.");
// Append it to the body
document.body.appendChild(aux);
// Highlight its content
aux.select();
// Copy the highlighted text
document.execCommand("copy");
// Remove it from the body
document.body.removeChild(aux);
alert("Print screen desabilitado.");
}
$(window).keyup(function(e){
if(e.keyCode == 44){
copyToClipboard();
}
});
$(window).focus(function() {
$("body").show();
}).blur(function() {
$("body").hide();
});
Run Code Online (Sandbox Code Playgroud)
以下是工作示例:
Sjo*_*erd 43
这是不可能的.
Dir*_*mar 38
您无法通过Web浏览器禁用屏幕抓取,只能通过在用户的PC上安装其他软件来实现.
有一些IRM(信息权限管理)工具可以实现这一点,例如通过保护Windows/DirectX API调用以及监视视频内存(如Oracle IRM或Microsoft的IRM技术).
特别是后者可能会引起关注,因为Internet Explorer还有一个Rights Management Add-on.
但正如其他人已经说过的,任何IRM/DRM技术都存在争议,你应该明白,它通常会限制或骚扰你的用户.
Pek*_*ica 15
值得庆幸的是,这个令人发指的想法无法可靠地实现,无论是"禁用屏幕抓取"部分还是"禁用用户的Firefox扩展"部分.即使它是,正如@kbok在上面的评论中指出的那样,你没有权利这样做.
在线保护您的内容的唯一方法是版权法 - 提及这些通常足以吓跑人们滥用它! - 或根本不显示.
ZX1*_*12R 13
试试这个
$(document).keyup(function(e){
if(e.keyCode == 44) return false;
});
Run Code Online (Sandbox Code Playgroud)
希望它有效
| 归档时间: |
|
| 查看次数: |
60367 次 |
| 最近记录: |