i am developing a website, i want disable print screen so i searched in the net and i used a JavaScript to disable print screen. it worked fine but during loading of a page it asks for the permission to access the clipboard.
the pop-up message that it shows,
"do u want to allow this webpage to access your clipboard? If you allow this, the webpage can access the clipboard and read information that you've cut or copied recently.. "
i want to avoid the above pop-up message and also disable print screen. Below is my JavaScript code.:
function AccessClipboardData() {
try {
window.clipboardData.setData('text', "Print Disabled");
} catch (err) {
}
<body>
<script language="JavaScript" type="text/javascript">
setInterval("AccessClipboardData()", 300);
var ClipBoardText = "";
if (window.clipboardData) {
ClipBoardText = window.clipboardData.getData('text');
ClipBoardText = window.clipboardData.clearData('text');
if (ClipBoardText == "") {
alert('Sorry you have to allow the page to access clipboard');
document.all("divmaster").style.display = "none"
}
}
</script>
</body>
can please help to solve that print screen and clip board problem.
thanks in advance..
i am developing a website, i want disable print screen so i searched in the net and i used a JavaScript to disable print screen. it worked fine but during loading of a page it asks for the permission to access the clipboard.
the pop-up message that it shows,
"do u want to allow this webpage to access your clipboard? If you allow this, the webpage can access the clipboard and read information that you've cut or copied recently.. "
i want to avoid the above pop-up message and also disable print screen. Below is my JavaScript code.:
function AccessClipboardData() {
try {
window.clipboardData.setData('text', "Print Disabled");
} catch (err) {
}
<body>
<script language="JavaScript" type="text/javascript">
setInterval("AccessClipboardData()", 300);
var ClipBoardText = "";
if (window.clipboardData) {
ClipBoardText = window.clipboardData.getData('text');
ClipBoardText = window.clipboardData.clearData('text');
if (ClipBoardText == "") {
alert('Sorry you have to allow the page to access clipboard');
document.all("divmaster").style.display = "none"
}
}
</script>
</body>
can please help to solve that print screen and clip board problem.
thanks in advance..
Share Improve this question asked Jun 1, 2011 at 6:39 ArunArun 1,7049 gold badges26 silver badges41 bronze badges 2- 2 I highly suggest that you not do this. You won't ever be able to get it to work how you want it to entirely. Personally, I run NoScript just to avoid these kinds of annoyances, and even if a web site gets past that, I can print screen the whole desktop and trim out your site's window. I can tell you that this turns me off of web sites; I don't like people dinking around with baked-in OS functionality. – King Skippus Commented Jun 1, 2011 at 6:44
- Considered giving question a -1, but really it's a good question. It's just that it can't be done and might be annoying if it's attempted. – RobG Commented Jun 1, 2011 at 7:01
2 Answers
Reset to default 4You must be trying to protect your page from theft or copy.
But I have only one to say to you. If the website loads on the clients puters, it means all the contents including images to markup all of them are stored on the client's PC and then displayed on the browser window. So, not matter what you do, there is never a final solution for this.
So, I suggest you to do not go down this road.
<input name="Print1" onclick="javascript:window.print();" type="button"
value="Print1" align="right"/> use this
onclick="javascript:window.print();" type="button" value="Print1" align="right"