How can I put an image into my webpage and prevent users to save it in their computers? I need to prevent users to use the Print Screen button on their keyboards and take a photo of my flash application... how can I use jQuery or JavaScript (or something like them) to do it?
Asked
Active
Viewed 3,015 times
0
-
4Give up. http://blog.slaks.net/2010/12/on-copy-prevention-in-html-part-1.html – SLaks Apr 15 '12 at 12:46
-
1The easy way is to put something 'on' the image - take as a good example: http://www.istockphoto.com/ – Ido Green Apr 15 '12 at 12:51
-
1`Printsreen` may be pressed with browsers window visible, but not in focus. – kirilloid Apr 15 '12 at 12:57
3 Answers
2
I am not sure that how you can prevent user from taking screen shot.
But there is a way to prevent right click and saving your image.
Not using js, but with css. Just set the image as background-image
instead of setting image tag src
.
I have been using this for some time. It works for me. It has some pros and cons.
Pros:
- The image will loaded by the browser, only when the element comes visible. It will save the initial load time of your page.(I mostly work with single page app. So, it works for me.)
Cons:
- You should set the same height and width if the image for the element too, If you want resolution of the image as same as it is. (I overcome this issue using
background-size
property. See below. Butbackground-size
browser support is not good.)
Still the user can save the image if he wants(with some developer tools &&|| etc), but all the users are not aware about that.
You can also use background-size: auto | contain | cover;
property.
I hope this may help you!
-
I knew that way and I use it always, but I'm looking for a way to make print screen button disabled! Thank you because of your time you spend to answer me! – SSS Apr 16 '12 at 06:04
1
Unforunately you can't. its a built in function to the operating system.

Menztrual
- 40,867
- 12
- 57
- 70
1
It's fairly safe to say that you can't. There always the possibility to block the right-click in js, but that's as far as you can go.

ksol
- 11,835
- 5
- 37
- 64
-
Even if one can block right click (some sites do that), no site could prevent me from opening firebug/webinspector, select an image in a DOM tree and find its `URL`. Needless to say about programs like TeleportPro or even network sniffers on the own machine. – kirilloid Apr 15 '12 at 12:58