/    Sign up×
Community /Pin to ProfileBookmark

Can we disable print screen using javascript? if yes how?

Hi,

We have a requirement to disable the print screen option of keyboard for a page on internet/intranet. any suggestions?

Thanks
VG

to post a comment
JavaScript

8 Comments(s)

Copy linkTweet thisAlerts:
@felgallSep 19.2008 — No you can't - it isn't a part of your web page.
Copy linkTweet thisAlerts:
@svidgenSep 19.2008 — Don't count on it.

There's absolutely nothing you can do to completely safeguard against someone getting a snapshot of a their screen if they really want it. Even if you were to find some way to do this, the user could simply blur() the browser window (click on the start menu, for example) and completely bypass your JavaScript or Java coolness.

And even if you were to write something [I][B]viral[/B][/I] that completely disabled their [I]PrntScr[/I] button on a [B]system[/B] level (that would be impressive), it's pretty unlikely you could get that viral code to be transmitted to their disconnected, non-bluetooth camera and disable [B][U][I]it[/I][/U][/B].

And even if you could somehow get that viral code to be transmitted to their disconnected non-bluetooth camera and disable it, it's even more unlikely that your virus could infect that old [I]film based camera[/I] in their junk drawer.

See where I'm going with this? ... [U]Your client/boss is delusional.[/U]

You may be able to inconvenience a user who wants a screeny, but they'll still get it if they want it.

If you're interested in inconveniencing a user who wants a screeny, I could make a few suggestions. But, it's hardly worth your time to entertain your (boss/client)'s absurd requirements.

dot dot dot
Copy linkTweet thisAlerts:
@js_vgauthorSep 19.2008 — Hi..Thanks for your inputs...i knew all these things and i have already conveyed but they want to publish it on the intranet site where people dont know much about the JS code and disabling it..So, for the sake of showing them, is there any code for disabling the 'Print screen' option?
Copy linkTweet thisAlerts:
@FourCourtJesterSep 19.2008 — svidgen nailed this on the head with his hilarious commentary.... the answer was also posted before him by felgall.

Sorry, but 'no' was the correct answer.
Copy linkTweet thisAlerts:
@svidgenSep 19.2008 — [I][B]Nope.[/B][/I]

If you want some evidence of this, try the following little page:
[code=html]<html>
<head>
<title>block keypresses?</title>
</head>
<body onKeyPress="alert('you pressed a key!'); return false;">
go ahead ... try it.
</body>
</html>[/code]

You'll notice that the PrntScrn key press isn't even detected. The OS apparently doesn't even pass that key to the browser, making it utterly impossible to override it or hide any content before the OS takes the shot.

Fair enough?
Copy linkTweet thisAlerts:
@Jeff_MottSep 19.2008 — The absolute only thing you could do is continually clear the clipboard. IE lets you do that (http://msdn.microsoft.com/en-us/library/ms535220(VS.85).aspx).

Beware, though, that it's ridiculously irritating to users who, when using your site, will unhappily discover they've lost whatever they had copied.
Copy linkTweet thisAlerts:
@felgallSep 19.2008 — You can printscreen without using the clipboard.

I use PaintShop Pro and right click and drag to define the area that I want to "Print Screen" without touching the keyboard. Since the browser doesn't receive the Print Screen button at all and web pages can't block the right mouse button at all there is nothing the web page can do to block either way of copying the content as an image.

As for the clipboard, JavaScript normally has no access to it either, only IE provides such access.

If it isn't in your web page you can't interact with it using JavaScript.
Copy linkTweet thisAlerts:
@KendoMay 25.2010 — ArtistScope provide a variety of solutions for protecting different media from Printscreen and ALL screen capture software... www.artistscope.com
×

Success!

Help @js_vg 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 5.17,
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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

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

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...