By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,619 Members | 1,861 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,619 IT Pros & Developers. It's quick & easy.

Capturing the 'Print Screen' keystroke event

P: 1

I suspect this is not possible, and perhaps someone will explain why, but does anyone know how to capture the 'PrintScreen' keystroke (and/or the 'Ctrl-PrintScreen' event)?

I would like to be able to do this in IE6/7, and FF2 would be 'nice to have' but not essential. Other browsers are not relevant.

I would like to trigger a small piece of script when a user tries presses the PrintScreen key.

I have an on-screen display that I would like to render unprintable. I know how to block the clipboard function, but I don't like that sort of intrusive code. The script I have will simply clear data that the user has entered on screen - rendering the use of the printscreen function very inconvenient.

Many thanks

PS - I'm a relative javascript beginner - so be gentle with me please!
Feb 3 '08 #1
Share this Question
Share on Google+
2 Replies

P: 428
PrtScn/SysReq key only fires onkeyup (44) in the window or a text field, so you cannot interrupt it. You can know that someone pressed it, but that seems like a small return for testing every keystroke.
Feb 3 '08 #2

Expert Mod 15k+
P: 16,027
Instead of trying to capture the "Print Screen" key, just use print-media stylesheets. See, for example, this link.
Feb 4 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.