Re: JavaScript, Print Screen & Windows Clipboard
- From: Randy Webb <HikksNotAtHome@xxxxxxx>
- Date: Tue, 25 Dec 2007 01:21:45 -0500
toronto@xxxxxxxx said the following on 12/24/2007 11:51 PM:
Seasons Greetings Everyone!
I want to use JavaScript's event object to detect whether someone has
pressed the 'PrintScreen' key to screenshot, via the Windows Clipboard,
and to print website content I don't want printed...
If you don't want it printed, log on to your server, delete the files. Then it can't be printed. Anything else is a futile waste of time.
It occurred to me that the easiest way to do this is to erase or replace
the contents of the Windows Clipboard...
Providing that you can dictate that your website users are using IE, they have script enabled, and they have allowed you programmatic access to the clipboard.
IE7:
Tools>Internet Options>Security Tab>Custom Level>Allow Programmatic clipboard access
Some code snippets I found at webdeveloper.com forums:
onfocus="javascript:window.clipboardData.clearData()"
This way their clipboard is emptied before they have he chance to paste.
No it isn't. Size your page smaller than the windows desktop, focus on anything other than the website, print screen, go to graphics program, paste it.
<!--Msg in span-->
<span id="copytext" style="display:none;">
You have mistakenly attempted to use the Print Scrn SysRq button or tried to copy something, which is a no-no. Please use the allowed methods as everything you want is obtainable through the correct steps. thank you, -site admin
</span>
<textarea id="holdtext" style="display:none;">
</textarea>
<script>function ClipBoard() {
holdtext.innerText = copytext.innerText;
Copied = holdtext.createTextRange();
Copied.execCommand("Copy");
setTimeout("ClipBoard()", 0001); }
ClipBoard();</script>
Open your page in IE.
Open a second IE.
Disable scripting.
Copy all you want.
Or, use any non-IE browser and copy what you want.
Clear your cache. Open the page. Go to the cache, copy what you want.
or u can diable highlight!!!!
No, you can try.
Since a lot of examples like this tend to deal with forms and/or
mouse text selection, can anyone explain what this code does, and
if I'm on the right track...? Thanks.
What it attempts to do is copy text to the clipboard - constantly - in a failed attempt to stop copy/paste actions. And no, you are not even close to being on the right track.
If you don't want it copied, printed, saved, don't let people view it.
--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
.
- References:
- JavaScript, Print Screen & Windows Clipboard
- From: toronto@xxxxxxxx
- JavaScript, Print Screen & Windows Clipboard
- Prev by Date: Re: JavaScript, Print Screen & Windows Clipboard
- Next by Date: Dynamically added images
- Previous by thread: Re: JavaScript, Print Screen & Windows Clipboard
- Next by thread: Dynamically added images
- Index(es):
Relevant Pages
|