How can I disable print-screen functionality for a webpage in all browsers?

女生的网名这么多〃 提交于 2019-11-27 15:44:32

What makes you think it's your decision if people should be able to take screenshots or not?

Luckily no browser but IE allows you to access the clipboard via JavaScript so you are out of luck :)

By the way, if I visited your site and it messed up my clipboard (it overwrites anything in there, even if it's unrelated to your site) - I might have stored something in it that I've just cut from some file and I was going to paste in a different file and thanks to your site it would now be lost.

So, the conclusion is: Stop doing crap like that.

If you're giving a sample of something you'll later want to sell to a customer then one thing you can do is have an image saying 'Copyrighted Material' and use it as a background on the webpage like a watermark. Disabling text selection, context menus and copying with CTRL + A is possible in both I.E. and Chrome, although I forget right now how I've done this (it was a CSS solution, and quite simple, too). Anyway, so that's one thing that can be done - if you can't protect it, spoil it so that it's unusable. Stock image sites use this method by watermarking their pictures, something that can be implemented on websites server-side with php, etc.

Try onKeyPress catch the PrtScr button, and return false. It's not pretty but I think that would work.

window.addEventListener("keyup",kPress,false);
function kPress(e)
{ 
var c=e.keyCode||e.charCode; 
if (c==44) alert("print screen");
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!