How to prevent user from downloading or saving an image?

后端 未结 11 1054
情深已故
情深已故 2020-12-06 20:39

Well, i have a web page where i am displaying few images. But my problem is that i don\'t want user to download or save those images. I can apply watermark to those images b

11条回答
  •  没有蜡笔的小新
    2020-12-06 21:15

    if you are using Apache server, you can disable accessing the image through absolute url
    the images can be access only with relative url with this htaccess code :

    RewriteEngine on
    RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?yourdomain.com [NC]
    RewriteRule \.(jpg|jpeg|png|gif)$ - [NC,F,L]
    

    in addition, disable the right click context using JavaScript, and add a watermark to protect the copy rights
    this will reduce the chance of saving the images

提交回复
热议问题