/    Sign up×
Community /Pin to ProfileBookmark

Disabling the print screen button

Hi everyone,

There are images I would like to protect on a webpage and I am intersted it being able to disable the print screen button with javascript. Is this possible?

I’m also open to using other options and languages.

Thanks,

Brian

to post a comment
JavaScript

19 Comments(s)

Copy linkTweet thisAlerts:
@Daniel_TAug 13.2004 — [url=http://www.thenamesdan.com/index.php?b=13]We should be real good friends[/url]. :p

No, it is not possible. Even if it was possible with JavaScript, the user could simply disable JavaScript to bypass it.
Copy linkTweet thisAlerts:
@BillyRayAug 13.2004 — I'm guessing that you didn't read the second of the two "locked" posts at the very top of this forum.

It is not possible, at all, ever, to stop someone from copying either source code or images from a webpage.

Hope this helps,

Dan
Copy linkTweet thisAlerts:
@neil9999Aug 13.2004 — [i]Originally posted by Daniel T [/i]

[B][url=http://www.thenamesdan.com/index.php?b=13]We should be real good friends[/url]. :p



No, it is not possible. Even if it was possible with JavaScript, the user could simply disable JavaScript to bypass it. [/B]
[/QUOTE]


Daniel, I saw your image protection page:

http://www.thenamesdan.com/imagepro/

I 'stole'it without using printscreen, I've attached the image. I looked in the source to find the image name:-

image.php?i=1

went to that page and cut-pasted it from there.

Neil?

[upl-file uuid=cfaa6f35-fdb6-4e14-8b60-343cff172bce size=7kB]imgpro.bmp[/upl-file]
Copy linkTweet thisAlerts:
@BillyRayAug 13.2004 — I think what you actually wanted was this image:

http://www.thenamesdan.com/imagepro/savemetodisk.gif

As I said - you [b]cannot[/b] stop people grabbing things.

Dan
Copy linkTweet thisAlerts:
@neil9999Aug 13.2004 — I thought the point of it was to steal the image you saw? If you can't even see the image, then why have it on your website?

Neil
Copy linkTweet thisAlerts:
@Daniel_TAug 13.2004 — [i]Originally posted by BillyRay [/i]

[B]http://www.thenamesdan.com/imagepro/savemetodisk.gif[/B][/QUOTE]

Aha... lemme guess... EditCSS? Damnit. Even more flawed than I had originally thought ?
Copy linkTweet thisAlerts:
@Daniel_TAug 13.2004 — [i]Originally posted by neil9999 [/i]

[B]I thought the point of it was to steal the image you saw? If you can't even see the image, then why have it on your website?



Neil [/B]
[/QUOTE]
If you can't see it, it must be because you have Referer Logging disabled, because everything is done on the server side, and relies on the referer.
Copy linkTweet thisAlerts:
@neil9999Aug 13.2004 — [i]Originally posted by Daniel T [/i]

[B]it must be because you have Referer Logging disabled [/B][/QUOTE]


Err...what's that?

I mean if you go to http://www.thenamesdan.com/imagepro/ are you meant to see 'Image protected' written everywhere and nothing else?

Neil
Copy linkTweet thisAlerts:
@Daniel_TAug 13.2004 — [i]Originally posted by neil9999 [/i]

[B]Err...what's that?[/B][/QUOTE]

Enabling referer logging allows the server to keep track of referers. The referer is the URL of the page that linked you to the current page. If there is no referer (ie: you did not get linked to the current page, but say, typed in the URL), then the Image Protection should work (well, not work, apparently ?) because it relies on the referer to decide wether to display the image or not, and since image.php is "linked to" through a background image on the index page, it should always have a referer.

[b]EDIT[/b]

And [url="http://www.thenamesdan.com/imagepro/savemetodisk.gif"]this[/url] is the image you [i]should[/i] have seen.
Copy linkTweet thisAlerts:
@BillyRayAug 13.2004 — Aha... lemme guess... EditCSS?[/quote]

Nope - httpExplorer - showed up the redirection filename ;o)

Dan
Copy linkTweet thisAlerts:
@Willy_DuittAug 14.2004 — I used the last of the following three Bookmarklets to snag your image. However, the image I snagged using this method ended up being a 41K bmp file while the redirect image BillyRay posted was a 3K gif file...

[b]BOOKMARKLET TO DISPLAY IMAGES BODY[/b][size=1]

javascript&#58;img='';for(var i=0;i<document.images.length;i++){img+='<img src='+document.images[i].src+'><br>'};if(img!=''){document.write('<center>'+img+'</center>');void(document.close())}else{alert('No images!')}[/size]






[b]BOOKMARKLET: DISPLAY IMAGES INLINE[/b][size=1]

javascript&#58;img='',el=document.getElementsByTagName('*');for(var i=0;i<el.length;i++){if(el[i].style.background){var url=el[i].style.background.substring(4,el[i].style.background.length-1);img+='<img src='+url+'><br><a href='+url+'>'+url+'</a><p>';}}document.write(img);[/size]






[b]BOOKMARKLET: DISPLAY IMAGES HEAD[/b][size=1]

javascript&#58;img='',el=document.getElementsByTagName('style');for(i=0; i<el.length; i++){reg=/url('([^']*)')/g;str=el[i].innerHTML.replace(/"/g,''');str=str.split(/n/);for(j=0;j<str.length;j++){if(str[j].match(reg)){url=RegExp.$1;img+='<img src='+url+'><br><a href='+url+'>'+url+'</a><p>';}}}document.write(img);[/size]




.....Willy



[b]Edit:[/b] Fixed the backward slash the forum software removed...
Copy linkTweet thisAlerts:
@sgrkadamSep 02.2005 — friends

I read out but actually what I mean that less it people should copy paste or even use there print screen to print or to copy my sites stuff

sgrkadam
Copy linkTweet thisAlerts:
@felgallSep 02.2005 — 
  • 1. Many firewalls and some browsers block the referrer from being passed at all so that all accesses appear to be direct.


  • 2. By the time that a browser displays anything, all of the files for that page are already downloaded to the local computer.
  • Copy linkTweet thisAlerts:
    @UltimaterSep 02.2005 — Man is this an old thread! Sgrkadam, did you know it's over a year old!? All the links in here are broken :p
    Copy linkTweet thisAlerts:
    @disablekeysOct 03.2005 — disable printscreen button / disable printscreen key

    try this script

    [URL=http://htmlblock.co.uk/scripts/disableprintscreen.zip]download[/URL]
    Copy linkTweet thisAlerts:
    @Tweak4Oct 03.2005 — try this script[/QUOTE]

    You're kidding, right?

    30 seconds of snooping will be enough for anyone who knows squat about scripting to tell that it's just an pseudo-encrypted call to a JS file running on the htmlblock website(http://htmlblock.co.uk/g346hd.js for those interested, though I haven't managed to get to the contents of the file itself just yet).

    Furthermore, the entire script is easily bypassed by:

    A: disabling javascript entirely

    B: disabling cross-domaing scripting, if you can, or

    C: catching the process in a debugger and merely setting "hp_ok = false" before the script's function calls are processed.

    Or if that doesn't suite your fancy, the page-source is still easily viewable (even though the script attempts to disable right-click menus), so anything on the page is still fair game.

    Furthermore, I also noticed that it totally disables the OS clipboard as long as a "blocked" window is open, which aside from being very annoying, is sure to drive users away from any site employing the script.

    This [I]might[/I] work on a casual surfer, but even then, I wouldn't count on it...


    As people have said countless times before, if you make something visible on a web page, it is loaded on the surfer's computer. Once it's there, they can cut/copy/paste/modify/hack/slash or do whatever else they want to it, and there is absolutely nothing you can do. If you want something "protected", leave it off the internet. Get used to it.
    Copy linkTweet thisAlerts:
    @sp00k113Jul 31.2007 — I've seen this request all over the internet. Also, I have seen (accompanying this

    question) all kinds of ignorance about it's uses. Everyone who responds seems to have some superior opinion about how it's not possible, or if it is possible, easily bypassed, or a violation of some unwritten internet standard.

    Have you ever thought about developers programming (for real money, not just some weekend hobby) an application which makes heavy use of javascript, and oh, just so happens to run in MSHTA?

    I can already tell from your pompous replies that the answer is no.

    What exactly are we talking about here?

    MSHTA apps won't run in firefox, and doesn't have an 'Internet Options' to (imagine a mockingly high pitched whiney tone? )'disable javascript, and bypass your script entirely'.

    I am talking about an MSHTA app, already written in javascript by many previous authors, running on thousands of workstations, displaying things like credit card numbers, socials, bank accounts, and credit reports, in addition to your run-of-the-mill personally identifiable information. In this day and age, where information is gold, I think we can agree that preventing the user from screen-shotting these things is definitely not on the 'unethical' side, and that trying to implement this solution would not be trying to 'change the way the internet works'. This is a corporate environment, a scenario where 3rd party apps are prevented from being installed by security policy, so no 'screenshot software' bypass is going to work.

    Imagine if suddenly, your boss makes you responsible for preventing screenshots and copy/paste from this app...and you don't program in javascript....what do you do? I want to say google the answer, and you will probably find it, but first you must sift through so much BS by these whiney nay-sayers, until you are so fed-up you wind up joining a random forum just to reply to a two year old thread with a post like this one.

    Instead of helping this guy, you nay-sayers just hide your ignorance of the function behind reasons to not even bother doing it, all in a feeble attempt to make yourself feel like 'the man' when you finally turn your monitor off, and not some socially inept ass who couldn't keep real friends because 'he's such an arrogant dick!'...BAH!

    function killClipboardData(){

    setInterval("window.clipboardData.setData('text','')",5);

    }

    function blockError(){

    window.location.reload(true);

    return true;

    }

    window.onerror = blockError;

    Just call killClipboardData() for your favorite key-(un)press event or onload to implement this. And stop listening to the arrogance of these whiners.
    Copy linkTweet thisAlerts:
    @felgallJul 31.2007 — The browser is fully under the control of its owner if they know how to use it properly. Any instructions attached to the web page are suggestions that they can configure their browser to ignore.

    In a corporate environment things are different because the network administrator controls what the computers on their network are allowed to do and so they can configure things at that level the way they want.

    The situation between the internet as a whole and coprorate intranets is completely different. If you don't specify that you are after a solution for a corporate intranet then the assumption will be made by most that you want a solution for the internet and the answer there is that it can't be done. Your solution will work on intranets but not the internet.
    Copy linkTweet thisAlerts:
    @slaughtersJul 31.2007 — ...Just call killClipboardData() for your favorite key-(un)press event or onload to implement this. And stop listening to the arrogance of these whiners.[/QUOTE]I don't believe that window.clipboardData.setData is supported in Firefox.

    The original post was made way back in 2004.

    The most recent post before yours was back in October 2005.
    ×

    Success!

    Help @haynbrian 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.19,
    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,
    )...