473,396 Members | 1,972 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

JavaScript, Print Screen & Windows Clipboard

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...

It occurred to me that the easiest way to do this is to erase or replace
the contents of the Windows Clipboard...

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.
..
..
..
<!--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>

or u can diable highlight!!!!

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.

CIAO
Dec 25 '07 #1
2 14241
rf

<to*****@bway.netwrote in message
news:rP******************************@bway.net...
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...
Cannot be done.

The desire to "hide" content is inversely proportional to the actual value
of that content to somebody else.

--
Richard.
Dec 25 '07 #2
to*****@bway.net 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/
Dec 25 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: annon | last post by:
I've noticed that some problems come up frequently that are of importance in writing web pages, because they're pretty fundamental points. For general reference, here are some collected...
1
by: MLH | last post by:
Last month, I posted this... http://support.microsoft.com/d­efault.aspx?scid=kb;en-us;1009­73 shows Function Screendump(). It is code that effectively does the same thing as pressing...
2
by: TheMax | last post by:
Hi, (excuse me for some errors in my english) I need to print a Tree View control, is it possibile? I search with google, both in newsgroup and web, but i have not find a solution until now. ...
7
by: e | last post by:
I've been having an extremely difficult time finding an answer to this in IE / js groups, so I thought I'd try here. I've got an aspx page that delivers loads of report data into custom-named...
1
by: Jason Huang | last post by:
Hi, I have no problem in printing the C# Windows Form codes. However, when it comes to print the Form, the "Print" button is greyed out and I can't print the form directly from the Visual Studio...
9
by: Cerebral Believer | last post by:
Hi folks, I am having some issues using a program that protects my web pages (to a degree) using JavaScript (to print screen/disable clipboard, caching text selection etc). Below is the code...
2
by: Bill H | last post by:
I would like to be able to open a new browser window and have it load a website I spefify, and when done I need to somehow get a copy of the browser screen into the clipboard (Alt Prints Screen in...
0
by: =?Utf-8?B?SHVtYW0=?= | last post by:
I am developing a windows service that reads from the serial port and then put the data read from the serial to the clipboard, so the client can use Ctrl + v to paste, I am using...
4
by: Robson Felix | last post by:
It may sound like a silly question, but I would like to print a form or component from within Visual Studio when designing such form component. Is that possible?
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.