简体   繁体   中英

Disable Printscreen by jQuery or Js

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?

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:

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

  1. 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. But background-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; background-size: auto | contain | cover; property.

I hope this may help you!

Unforunately you can't. its a built in function to the operating system.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM