/    Sign up×
Community /Pin to ProfileBookmark

Disable PrintScreen / Copy/Paste functionality

Hi,
I am working in a sort of “virtual classroom”. I needed to disable the copy/paste functionality in the application pages, to prevent users for copying the info and store it in their PC. The idea is the user to read, to take notes, etc … but not to copy the info from the screen, so they have to enter to the page(s) in order to study from there.

I found this piece of code to disable PrintScreen / Copy+Paste functionality:

======
<html>
<head>
<script language=”javascript”>

function setClipBoardData(){
setInterval(“window.clipboardData.setData(‘text’,”)”,20);
}
function blockError(){
window.location.reload(true);
return true;
}

</script>
</head>

<body onload=”setClipBoardData();”>
YOU TRY TO COPY AND PASTE THIS SCREEN, AND ALL THE ACTIVE SCREENS

</body>

</html>
======

I noticed the Copy/Paste functionality of my Windows session was disabled (i could not copy and/or paste anything, from the moment I open the page with the code mentioned above) so I had to restart my user session (thank God I didn’t need to restart the computer ? ) and then I have my copy/paste functional¡ty back.

Do you have some ideas in order to enable again the Copy/Paste functionality, by modifying this piece of code?

T.I.A

to post a comment
JavaScript

12 Comments(s)

Copy linkTweet thisAlerts:
@VladdyNov 14.2003 — forget about it.

The files ARE stored on the user computer before they are displayed in the browser. What you are doing with this script is as EXTREEMLY annoying as it is easily bypassed by disabling javascript.
Copy linkTweet thisAlerts:
@CalibanauthorNov 14.2003 — I agree with you (disabling javascript is the easy way to strike back)

These are the possible ways to copy/paste info:

1) By pressing the PrintScreen key

2) By pressing the keys combination: Alt + PrintScreen

3) By disabling the right mouse

I know how to achieve the points 2) and 3)

but the PrintScreen key code ... I've not been able to control it.

Some ideas about these three points?


T.I.A.
Copy linkTweet thisAlerts:
@AdamBrillNov 14.2003 — [i]Originally posted by Caliban [/i]

[B]I needed to disable the copy/paste functionality in the application pages, to prevent users for copying the info and store it in their PC. The idea is the user to read, to take notes, etc ... but not to copy the info from the screen, so they have to enter to the page(s) in order to study from there.[/B][/QUOTE]
Absolutely impossible. Fortunately, browsers allow users to have control over their own computers rather than giving the control to the site on the internet. The only thing you could manage by trying to get it to work is getting users to not use your site because of the annoyance. The internet is a public place meant to give out information, not to protect it.

BTW, the list of ways to copy and paste info is about 100 miles longer than that...
Copy linkTweet thisAlerts:
@CalibanauthorNov 14.2003 — Hi Vladdy,

first of all, thanx for your interest.

The copy/paste restricts are corporative guidelines. The pages will be published over our intranet, not over internet. And the site must work as i described it. The users agree.

The idea is that the user must be evaluated later, and he must not have the docs in his hands/PC, 'cause he must enter to another pages in which he will be evaluated (in the school -at least in mine- , our teachers didn't let us to have the answers written in "auxiliary devices" like hands, chairs, li'l pieces of paper, etc ? - everything must be in the brain. That's what I want you to understand.

The site works fine with the piece of code I supply, I just only want to know how to activate the copy/paste again, either using a "onclose" event or something like that ? That's all.

I'll keep on receiving ideas.

T.I.A.
Copy linkTweet thisAlerts:
@AdamBrillNov 14.2003 — [i]Originally posted by Caliban [/i]

[B]The idea is that the user must be evaluated later, and he must not have the docs in his hands/PC, 'cause he must enter to another pages in which he will be evaluated (in the school -at least in mine- , our teachers didn't let us to have the answers written in "auxiliary devices" like hands, chairs, li'l pieces of paper, etc ? - everything must be in the brain. That's what I want you to understand.[/B][/QUOTE]
I understand that, but the internet just doesn't have the capability to control the users browser like that.

Your original code doesn't seem to work for me, but here is how you would stop your original code:&lt;html&gt;
&lt;head&gt;
&lt;script type="text/javascript"&gt;
function start(){
block = setInterval("window.clipboardData.setData('text','')",20);
}
function stop(){
clearInterval(block);
}
&lt;/script&gt;
&lt;/head&gt;

&lt;body onload="start();"&gt;
YOU TRY TO COPY AND PASTE THIS SCREEN, AND ALL THE ACTIVE SCREENS
&lt;input type="button" onclick="stop();" value="stop blocking copy/paste!"&gt;

&lt;/body&gt;
&lt;/html&gt;
I hope this helps you, but if this is for something official, I would highly suggest that you don't use it since it will be extremely easy to "cheat".
Copy linkTweet thisAlerts:
@Jeff_MottNov 14.2003 — The idea is that the user must be evaluated later, and he must not have the docs in his hands/PC, 'cause he must enter to another pages in which he will be evaluated. That's what I want you to understand.[/quote]Here's what we want you to understand. There is no method that cannot be defeated in a matter of seconds. And maybe they don't even need to save it. What would keep them from leaving the info window open while they proceed to the evaluation? The World Wide Wide was designed to [i]provide[/i] access to information, not restrict it. If ensuring this information is not retained in any way is absolutely essential then the WWW is not the medium you should be using.
Copy linkTweet thisAlerts:
@sanker_sMar 28.2006 — Thanks for your tip. I tried in IE and firefox. It works in IE but not in firefox.
Copy linkTweet thisAlerts:
@fb755Mar 29.2006 — What about converting the text to an image or the document to PDF then? They will be able to copy the entire thing, but won't be able to copy and paste text per se.
Copy linkTweet thisAlerts:
@felgallMar 29.2006 — You can password protect the select and print facilities within PDFs so that your regular visitors can't do those things with the PDF. It can't be done with HTML.
Copy linkTweet thisAlerts:
@Wisest_GuyMar 29.2006 — Save page as.

Client saves page then has content.

Or right click a link to page, Save target as.

If you send it to the user, it's too late, they have it.

No way to stop it.
Copy linkTweet thisAlerts:
@nreb10Jan 14.2009 — Hi Caliban,

What code did you use to disable Alt + PrintScreen?

Thanks
Copy linkTweet thisAlerts:
@felgallJan 14.2009 — Hi Caliban,

What code did you use to disable Alt + PrintScreen?

Thanks[/QUOTE]


Since it is an intranet the operating system settings on the computer can be changed to disable that function.

For the JavaScript to always work you also need to turn off the access to the browser options/preferences so that the person using the computer can't disable the JavaScript.
×

Success!

Help @Caliban spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...