Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
319 views
in Technique[技术] by (71.8m points)

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

Using the following we can disable print-screens or screenshots in Internet Explorer:

<body onload=setInterval("window.clipboardData.setData('text','')",2) 

oncontextmenu="return false" onselectstart="return false">

But these don't work in Mozilla, Chrome and other browsers.

Is there a better way to disable print-screens/screenshots?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...